Serialise publishes to avoid concurrent-rsync failures#342
Conversation
|
For reference, the error from Sentry: Run: 'rsync -a --delete-delay --filter 'P archives/' /srv/docsbuild/cpython-only-html/Doc/build/html/ /srv/docs.python.org/3.15' KO:Issue ID: 7209728782 MessageRun: 'rsync -a --delete-delay --filter 'P archives/' /srv/docsbuild/cpython-only-html/Doc/build/html/ /srv/docs.python.org/3.15' KO: Tags
Breadcrumbs
|
|
Claude review: Nice fix — the lock key maps 1:1 onto the target directory, so this correctly serialises the One suggestion on the timeout path: the bare Suggest converting the timeout into a self-describing except zc.lockfile.LockError as err:
if perf_counter() >= deadline:
raise TimeoutError(
f"Gave up waiting for lock {path.name} "
f"after {timeout} seconds"
) from err
logging.info("Waiting for lock %s...", path.name)
sleep(poll_interval)and giving it a dedicated handler in except TimeoutError as err:
# Another builder held the publish lock for too long; the docs
# were built fine and will be published on the next run.
logging.error("%s", err)
if sentry_sdk:
sentry_sdk.capture_exception(err)
return FalseThat way a timeout still reaches Sentry (a publish exceeding 10 minutes is worth knowing about) but as a distinct, self-explanatory event that groups separately. If we'd rather stay quiet like Relatedly, the timeout would fire far less often if the critical section were slimmer: |
I applied the suggestion.
Realistically hitting the ten minute timeout seems very unlikely, and saving a few seconds won't be of much help. I'd rather avoid refactors for theoretical cases. |
hugovk
left a comment
There was a problem hiding this comment.
Thanks! The main thing is not sending new Sentry reports when we didn't before. I think we hit the timeout more in the past when we still did PDFs and some translations took a long time, especially before Sphinx made some big performance improvements.
This fixes https://python-software-foundation.sentry.io/issues/7209728782/?query=is%3Aunresolved&referrer=issue-stream.