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

Commit

Permalink
Fix bug where we didn't clear _current_event_fetches correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
erikjohnston committed Jul 28, 2021
1 parent 1b69346 commit f94884d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions synapse/storage/databases/main/events_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,8 @@ def __init__(self, database: DatabasePool, db_conn, hs):
max_size=hs.config.caches.event_cache_size,
)

# Map from event ID to a deferred tat will result in an
# Optional[_EventCacheEntry].
# Map from event ID to a deferred that will result in an
# Dict[str, _EventCacheEntry].
self._current_event_fetches: Dict[str, ObservableDeferred] = {}

# We keep track of the events we have currently loaded in memory so that
Expand Down Expand Up @@ -542,7 +542,8 @@ async def _get_events_from_cache_or_db(
# deferred to the the map of events that are being fetched.
self._current_event_fetches[event_id] = fetching_deferred
fetching_deferred.observe().addBoth(
lambda _: self._current_event_fetches.pop(event_id, None)
lambda _, event_id: self._current_event_fetches.pop(event_id, None),
event_id,
)

missing_events_ids.difference_update(already_fetching)
Expand Down

0 comments on commit f94884d

Please sign in to comment.