fix(web-app-docs): stop a poll from sending the awaited build to the back

`request()` ended in `touch(exist_ok=True)`, and on an existing file that
refreshes the mtime. `next_queued()` sorts by mtime and serves the oldest
marker, so re-requesting a build that is already queued moved it behind
everything else. The server calls `request()` on every visit, and a visitor
waiting for a page polls every thirty seconds, so waiting for a build was
what prevented it:

    queued de, then a tag : ['deployed:de', 'v14.2.0'] -> builds deployed:de
    after one poll on de  : ['v14.2.0', 'deployed:de'] -> builds v14.2.0

One poll is enough. In the docs suite the spec before it deliberately clicks
an unbuilt release tag, so another hour-long build is always sitting there to
be overtaken by.

Observed in run 36596159856: `/deployed/de/` answered 202 and never 200 for
two hours and four minutes in one deployment and two hours fifty-seven in
another, from those jobs' own rescue artifacts, while the suite budget is
fifty-nine minutes on clearnet and eighty-nine on tor.

This removes the starvation, not the arithmetic: a full Sphinx build costs
sixty to ninety minutes here and the suite needs two of them in sequence,
English then German. Whether one round now fits is for a run to say.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
kevinveenbirkenbachandClaude Opus 5 committed 2026-09-30 01:46:03 +02:00
1 parent 5a4f979c0e
commit 40688e4ded
2 files changed
+17 -1

No files matched your search

@@ -44,7 +44,10 @@ class Queue:
lane.mkdir(parents=True, exist_ok=True)
if background and (self.queue / marker).exists():
return
(lane / marker).touch(exist_ok=True)
queued = lane / marker
if queued.exists():
return
queued.touch()
def _dequeue(self, marker):
"""Drop ``marker`` from both lanes.
@@ -109,6 +109,19 @@ class TestDrain(QueueFixture, unittest.TestCase):
self.assertEqual(self.library.next_queued(), "latest:de")
def test_polling_does_not_send_the_awaited_build_to_the_back(self) -> None:
"""The visitor polls every 30s, and each poll re-requests. Refreshing
the marker's mtime would make waiting for a build prevent it."""
self.library._dequeue("latest")
self._serve("latest")
self._index("latest", ["de"])
self.library.request("latest", "de")
self.library.request("v14.2.0")
self.library.request("latest", "de")
self.assertEqual(self.library.next_queued(), "latest:de")
def test_the_background_lane_is_drained_once_the_front_is_empty(self) -> None:
self.library._dequeue("latest")
self._serve("latest")