diff options
author | Nick Mills-Barrett <nick@beeper.com> | 2022-05-25 10:46:05 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-25 09:46:05 +0000 |
commit | 33e2916858c0503a54be1c01e242123dcfb02e21 (patch) | |
tree | 2d1122246ad5c6fd7f515ba2a1e10cb2f36531ec | |
parent | Add the `/account/whoami` endpoint to generic workers (#12866) (diff) | |
download | synapse-33e2916858c0503a54be1c01e242123dcfb02e21.tar.xz |
Don't create empty AS txns when the AS is down (#12869)
-rw-r--r-- | changelog.d/12869.misc | 1 | ||||
-rw-r--r-- | synapse/appservice/scheduler.py | 6 |
2 files changed, 6 insertions, 1 deletions
diff --git a/changelog.d/12869.misc b/changelog.d/12869.misc new file mode 100644 index 0000000000..1d9d1c8921 --- /dev/null +++ b/changelog.d/12869.misc @@ -0,0 +1 @@ +Don't generate empty AS transactions when the AS is flagged as down. Contributed by Nick @ Beeper. diff --git a/synapse/appservice/scheduler.py b/synapse/appservice/scheduler.py index 3b49e60716..de5e5216c2 100644 --- a/synapse/appservice/scheduler.py +++ b/synapse/appservice/scheduler.py @@ -384,6 +384,11 @@ class _TransactionController: device_list_summary: The device list summary to include in the transaction. """ try: + service_is_up = await self._is_service_up(service) + # Don't create empty txns when in recovery mode (ephemeral events are dropped) + if not service_is_up and not events: + return + txn = await self.store.create_appservice_txn( service=service, events=events, @@ -393,7 +398,6 @@ class _TransactionController: unused_fallback_keys=unused_fallback_keys or {}, device_list_summary=device_list_summary or DeviceListUpdates(), ) - service_is_up = await self._is_service_up(service) if service_is_up: sent = await txn.send(self.as_api) if sent: |