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

Do not keep going if there are 5 back-to-back background update failures. #12781

Merged
merged 2 commits into from
May 18, 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/12781.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Do not keep going if there are 5 back-to-back background update failures.
8 changes: 8 additions & 0 deletions synapse/storage/background_updates.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,12 +282,20 @@ async def run_background_updates(self, sleep: bool) -> None:

self._running = True

back_to_back_failures = 0

try:
logger.info("Starting background schema updates")
while self.enabled:
try:
result = await self.do_next_background_update(sleep)
back_to_back_failures = 0
except Exception:
back_to_back_failures += 1
if back_to_back_failures >= 5:
raise RuntimeError(
"5 back-to-back background update failures; aborting."
)
logger.exception("Error doing update")
else:
if result:
Expand Down