Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Improve event caching code #10119

Merged
merged 16 commits into from
Aug 4, 2021
Prev Previous commit
Next Next commit
Correctly drop logging contexts
erikjohnston committed Aug 3, 2021
commit 0f9e19cd1100c974bb4d32265a575a63a10f3f3e
6 changes: 4 additions & 2 deletions synapse/storage/databases/main/events_worker.py
Original file line number Diff line number Diff line change
@@ -553,14 +553,16 @@ async def _get_events_from_cache_or_db(

event_entry_map.update(missing_events)
except Exception as e:
fetching_deferred.errback(e)
with PreserveLoggingContext():
fetching_deferred.errback(e)
raise e
finally:
# Ensure that we mark these events as no longer being fetched.
for event_id in missing_events_ids:
self._current_event_fetches.pop(event_id, None)

fetching_deferred.callback(missing_events)
with PreserveLoggingContext():
fetching_deferred.callback(missing_events)

if already_fetching:
# Wait for the other event requests to finish and add their results