diff options
author | Patrick Cloke <clokep@users.noreply.github.com> | 2021-08-13 07:49:06 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-13 11:49:06 +0000 |
commit | c12b5577f22ee587b60ad7b65e88322ce1d86b7b (patch) | |
tree | 46aa067c4e888a666bd52f7d9ad5224500024535 | |
parent | Stop building a debian package for Groovy Gorilla (#10588) (diff) | |
download | synapse-c12b5577f22ee587b60ad7b65e88322ce1d86b7b.tar.xz |
Fix a harmless exception when the staged events queue is empty. (#10592)
-rw-r--r-- | changelog.d/10592.bugfix | 1 | ||||
-rw-r--r-- | synapse/federation/federation_server.py | 15 |
2 files changed, 11 insertions, 5 deletions
diff --git a/changelog.d/10592.bugfix b/changelog.d/10592.bugfix new file mode 100644 index 0000000000..efcdab1136 --- /dev/null +++ b/changelog.d/10592.bugfix @@ -0,0 +1 @@ +Fix a bug introduced in v1.37.1 where an error could occur in the asyncronous processing of PDUs when the queue was empty. diff --git a/synapse/federation/federation_server.py b/synapse/federation/federation_server.py index 0385aadefa..78d5aac6af 100644 --- a/synapse/federation/federation_server.py +++ b/synapse/federation/federation_server.py @@ -972,13 +972,18 @@ class FederationServer(FederationBase): # the room, so instead of pulling the event out of the DB and parsing # the event we just pull out the next event ID and check if that matches. if latest_event is not None and latest_origin is not None: - ( - next_origin, - next_event_id, - ) = await self.store.get_next_staged_event_id_for_room(room_id) - if next_origin != latest_origin or next_event_id != latest_event.event_id: + result = await self.store.get_next_staged_event_id_for_room(room_id) + if result is None: latest_origin = None latest_event = None + else: + next_origin, next_event_id = result + if ( + next_origin != latest_origin + or next_event_id != latest_event.event_id + ): + latest_origin = None + latest_event = None if latest_origin is None or latest_event is None: next = await self.store.get_next_staged_event_for_room( |