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

Don't create empty AS txns when the AS is down #12869

Merged
merged 2 commits into from
May 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/12869.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Don't generate empty AS transactions when the AS is flagged as down. Contributed by Nick @ Beeper.
6 changes: 5 additions & 1 deletion synapse/appservice/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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:
Expand Down