From 85951224ad2017e6e81564e0e83c836d1f4720e3 Mon Sep 17 00:00:00 2001 From: Nick Mills-Barrett Date: Mon, 25 Apr 2022 18:22:51 +0100 Subject: [PATCH 1/2] Don't create empty AS txns when the AS is down --- synapse/appservice/scheduler.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/synapse/appservice/scheduler.py b/synapse/appservice/scheduler.py index 3b49e6071677..de5e5216c223 100644 --- a/synapse/appservice/scheduler.py +++ b/synapse/appservice/scheduler.py @@ -384,6 +384,11 @@ async def send( 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 @@ async def send( 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: From 9425bc206c46d7000fd57198994b2577e9c4988b Mon Sep 17 00:00:00 2001 From: Nick Mills-Barrett Date: Wed, 25 May 2022 10:21:21 +0100 Subject: [PATCH 2/2] Add changelog file --- changelog.d/12869.misc | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/12869.misc diff --git a/changelog.d/12869.misc b/changelog.d/12869.misc new file mode 100644 index 000000000000..1d9d1c8921de --- /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.