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

Commit

Permalink
Fix call to have_seen_events
Browse files Browse the repository at this point in the history
Let's actually implement `have_seen_event`, to make it easier for people to not
shoot their feet off here.
  • Loading branch information
richvdh committed Apr 1, 2022
1 parent eded885 commit 09599a7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion synapse/handlers/federation_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -989,7 +989,7 @@ async def _get_state_and_persist(
)

# we also need the event itself.
if not await self._store.have_seen_events(room_id, event_id):
if not await self._store.have_seen_event(room_id, event_id):
await self._get_events_and_persist(
destination=destination, room_id=room_id, event_ids=(event_id,)
)
Expand Down
8 changes: 3 additions & 5 deletions synapse/storage/databases/main/events_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
Dict,
Iterable,
List,
NoReturn,
Optional,
Set,
Tuple,
Expand Down Expand Up @@ -1330,10 +1329,9 @@ def have_seen_events_txn(
return results

@cached(max_entries=100000, tree=True)
async def have_seen_event(self, room_id: str, event_id: str) -> NoReturn:
# this only exists for the benefit of the @cachedList descriptor on
# _have_seen_events_dict
raise NotImplementedError()
async def have_seen_event(self, room_id: str, event_id: str) -> bool:
res = await self._have_seen_events_dict(((room_id, event_id),))
return res[(room_id, event_id)]

def _get_current_state_event_counts_txn(
self, txn: LoggingTransaction, room_id: str
Expand Down

0 comments on commit 09599a7

Please sign in to comment.