From 40688e4deda748045f80d65f8fd7474b5bb11608 Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Wed, 30 Sep 2026 01:46:03 +0200 Subject: [PATCH] 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) --- .../files/python/infinito_docs/build_queue.py | 5 ++++- .../files/infinito_docs/test_build_queue.py | 13 +++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/roles/web-app-docs/files/python/infinito_docs/build_queue.py b/roles/web-app-docs/files/python/infinito_docs/build_queue.py index 8456c8ad5c..b5aae2311a 100644 --- a/roles/web-app-docs/files/python/infinito_docs/build_queue.py +++ b/roles/web-app-docs/files/python/infinito_docs/build_queue.py @@ -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. diff --git a/tests/unit/python/roles/web-app-docs/files/infinito_docs/test_build_queue.py b/tests/unit/python/roles/web-app-docs/files/infinito_docs/test_build_queue.py index e72097a64c..79c3461ad5 100644 --- a/tests/unit/python/roles/web-app-docs/files/infinito_docs/test_build_queue.py +++ b/tests/unit/python/roles/web-app-docs/files/infinito_docs/test_build_queue.py @@ -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")