mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2024-09-06 20:21:53 +00:00
Do not keep going if there are 5 back-to-back background update failures. (#12781)
This commit is contained in:
parent
df4963548b
commit
635f0d916b
1
changelog.d/12781.misc
Normal file
1
changelog.d/12781.misc
Normal file
@ -0,0 +1 @@
|
|||||||
|
Do not keep going if there are 5 back-to-back background update failures.
|
@ -282,12 +282,20 @@ class BackgroundUpdater:
|
|||||||
|
|
||||||
self._running = True
|
self._running = True
|
||||||
|
|
||||||
|
back_to_back_failures = 0
|
||||||
|
|
||||||
try:
|
try:
|
||||||
logger.info("Starting background schema updates")
|
logger.info("Starting background schema updates")
|
||||||
while self.enabled:
|
while self.enabled:
|
||||||
try:
|
try:
|
||||||
result = await self.do_next_background_update(sleep)
|
result = await self.do_next_background_update(sleep)
|
||||||
|
back_to_back_failures = 0
|
||||||
except Exception:
|
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")
|
logger.exception("Error doing update")
|
||||||
else:
|
else:
|
||||||
if result:
|
if result:
|
||||||
|
Loading…
Reference in New Issue
Block a user