fix: claim the pack output before refreshing data

generate_pack refreshed the data directories before probing its output
lock. The refresh waits for every run holding a tree, and a pipeline holds
them all: a second build sat silent for hours instead of being refused.
The output lock is now taken first, and a refresh that has to wait for a
tree names it.
This commit is contained in:
Abdessamad Derraz committed 2026-10-21 05:21:54 +02:00
1 parent bca76e8ace
commit 0061041466
4 files changed
+123 -36

No files matched your search

+27
View File
@@ -166,6 +166,33 @@ class EmulatorPackHoldsTheCache(unittest.TestCase):
self.assertEqual(held, [True])
class AWaitIsAnnounced(unittest.TestCase):
def test_a_held_tree_is_named_before_the_wait(self):
"""A pipeline holds every tree for its run: the refresh beside it
waited with nothing on screen."""
with tempfile.TemporaryDirectory() as tmp:
cache = Path(tmp) / "probe"
taken = threading.Event()
def second_run() -> None:
with rdd.cache_lock(cache):
taken.set()
with self.assertLogs(rdd.log, "WARNING") as logs:
with rdd.cache_lock(cache):
worker = threading.Thread(target=second_run)
worker.start()
for _ in range(100):
if logs.output:
break
threading.Event().wait(0.05)
self.assertFalse(taken.is_set())
worker.join(10)
self.assertTrue(taken.is_set())
self.assertIn("waiting for", logs.output[0])
self.assertIn("probe", logs.output[0])
class DryRunReport(unittest.TestCase):
"""What a dry run says: why each entry would be fetched, and how many."""