diff options
author | David Robertson <davidr@element.io> | 2022-12-15 16:11:45 +0000 |
---|---|---|
committer | David Robertson <davidr@element.io> | 2022-12-15 16:11:45 +0000 |
commit | b373c3655aecc7418e6801a2e5df9a203809f5a6 (patch) | |
tree | 91d6ca50ca29c24dcf0a0c3b223d9766d9a30c1d | |
parent | Merge tag 'v1.74.0rc1' into develop (diff) | |
download | synapse-b373c3655aecc7418e6801a2e5df9a203809f5a6.tar.xz |
Pull "tidy up after resync" logic out of the loop
I find it cleaner, but YMMV
-rw-r--r-- | synapse/handlers/federation.py | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/synapse/handlers/federation.py b/synapse/handlers/federation.py index b2784d7333..741dc15c8a 100644 --- a/synapse/handlers/federation.py +++ b/synapse/handlers/federation.py @@ -1689,19 +1689,7 @@ class FederationHandler: logger.info("Clearing partial-state flag for %s", room_id) success = await self.store.clear_partial_state_room(room_id) if success: - logger.info("State resync complete for %s", room_id) - self._storage_controllers.state.notify_room_un_partial_stated( - room_id - ) - # Poke the notifier so that other workers see the write to - # the un-partial-stated rooms stream. - self._notifier.notify_replication() - - # TODO(faster_joins) update room stats and user directory? - # https://github.com/matrix-org/synapse/issues/12814 - # https://github.com/matrix-org/synapse/issues/12815 - return - + break # we raced against more events arriving with partial state. Go round # the loop again. We've already logged a warning, so no need for more. continue @@ -1767,6 +1755,15 @@ class FederationHandler: destination, ) + logger.info("State resync complete for %s", room_id) + self._storage_controllers.state.notify_room_un_partial_stated(room_id) + # Poke the notifier so that other workers see the write to + # the un-partial-stated rooms stream. + self._notifier.notify_replication() + + # TODO(faster_joins) update room stats and user directory? + # https://github.com/matrix-org/synapse/issues/12814 + # https://github.com/matrix-org/synapse/issues/12815 def _prioritise_destinations_for_partial_state_resync( initial_destination: Optional[str], |