Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Generator in update_cached_last_access_time #17816

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/17816.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Avoid lost data on some database query retries.
6 changes: 3 additions & 3 deletions synapse/storage/databases/main/media_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -729,18 +729,18 @@ def update_cache_txn(txn: LoggingTransaction) -> None:

txn.execute_batch(
sql,
(
[
(time_ms, media_origin, media_id)
for media_origin, media_id in remote_media
),
],
)

sql = (
"UPDATE local_media_repository SET last_access_ts = ?"
" 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
Expand Down
Loading