summary refs log tree commit diff
diff options
context:
space:
mode:
authorJason Little <realtyem@gmail.com>2024-10-30 20:16:24 -0500
committerGitHub <noreply@github.com>2024-10-30 20:16:24 -0500
commit0c429fae1ded5b7348abf1d7695fec908018c3c1 (patch)
tree2552d3a174d72da8f58207094e7c861995a83b6e
parentRemove `Generator` in `store_search_entries_txn` (#17817) (diff)
downloadsynapse-0c429fae1ded5b7348abf1d7695fec908018c3c1.tar.xz
Remove `Generator` in `update_cached_last_access_time` (#17816)
Context: https://github.com/matrix-org/synapse/issues/15439
(https://github.com/element-hq/synapse/issues/15439)

Also see discussion in https://github.com/element-hq/synapse/pull/17813
Diffstat (limited to '')
-rw-r--r--changelog.d/17816.bugfix1
-rw-r--r--synapse/storage/databases/main/media_repository.py6
2 files changed, 4 insertions, 3 deletions
diff --git a/changelog.d/17816.bugfix b/changelog.d/17816.bugfix
new file mode 100644

index 0000000000..5dd276709b --- /dev/null +++ b/changelog.d/17816.bugfix
@@ -0,0 +1 @@ +Avoid lost data on some database query retries. diff --git a/synapse/storage/databases/main/media_repository.py b/synapse/storage/databases/main/media_repository.py
index 7617fd3ad4..7a96e25432 100644 --- a/synapse/storage/databases/main/media_repository.py +++ b/synapse/storage/databases/main/media_repository.py
@@ -729,10 +729,10 @@ class MediaRepositoryStore(MediaRepositoryBackgroundUpdateStore): txn.execute_batch( sql, - ( + [ (time_ms, media_origin, media_id) for media_origin, media_id in remote_media - ), + ], ) sql = ( @@ -740,7 +740,7 @@ class MediaRepositoryStore(MediaRepositoryBackgroundUpdateStore): " WHERE media_id = ?" ) - txn.execute_batch(sql, ((time_ms, media_id) for media_id in local_media)) + txn.execute_batch(sql, [(time_ms, media_id) for media_id in local_media]) await self.db_pool.runInteraction( "update_cached_last_access_time", update_cache_txn