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

This commit is contained in:
reivilibre 2022-05-18 13:57:59 +00:00 committed by GitHub
parent df4963548b
commit 635f0d916b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 0 deletions

1
changelog.d/12781.misc Normal file
View file

@ -0,0 +1 @@
Do not keep going if there are 5 back-to-back background update failures.

View file

@ -282,12 +282,20 @@ class BackgroundUpdater:
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: