Skip to content

Commit 4c311c1

Browse files
Apply @claude's (Hugo's?) suggestion
1 parent 7ba70b1 commit 4c311c1

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

build_docs.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -563,9 +563,11 @@ def wait_for_lock(
563563
try:
564564
lock = zc.lockfile.LockFile(path)
565565
break
566-
except zc.lockfile.LockError:
566+
except zc.lockfile.LockError as err:
567567
if perf_counter() >= deadline:
568-
raise
568+
raise TimeoutError(
569+
f"Gave up waiting for lock {path.name} after {timeout} seconds"
570+
) from err
569571
logging.info("Waiting for lock %s...", path.name)
570572
sleep(poll_interval)
571573
try:
@@ -684,6 +686,13 @@ def run(self, http: urllib3.PoolManager, force_build: bool) -> bool | None:
684686
)
685687
else:
686688
return None # skipped
689+
except TimeoutError as err:
690+
# Another builder held the publish lock for too long; the docs
691+
# were built fine and will be published on the next run.
692+
logging.error("%s", err)
693+
if sentry_sdk:
694+
sentry_sdk.capture_exception(err)
695+
return False
687696
except Exception as err:
688697
logging.exception("Badly handled exception, human, please help.")
689698
if sentry_sdk:

0 commit comments

Comments
 (0)