diff options
Diffstat (limited to 'packages/meshbay-node/tests/test_task_lifetime.py')
| -rw-r--r-- | packages/meshbay-node/tests/test_task_lifetime.py | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/packages/meshbay-node/tests/test_task_lifetime.py b/packages/meshbay-node/tests/test_task_lifetime.py index 8897e71..e1ebfed 100644 --- a/packages/meshbay-node/tests/test_task_lifetime.py +++ b/packages/meshbay-node/tests/test_task_lifetime.py @@ -8,9 +8,10 @@ pending!" and nothing else happens. For `_stream_video` that was expensive. It holds a transcode slot for its whole life with `async with sem`, and a destroyed task never reaches `__aexit__`. The -node allows two, so two abandoned streams left it answering "Server busy" to -every request from then on: videos stopped playing entirely, first try included, -until the daemon was restarted. +node allows only a handful, so a few abandoned streams left it answering +"Server busy" to every request from then on: videos stopped playing entirely, +first try included, until the daemon was restarted. It was two slots at the +time, which is how few it took. Seen in the wild on 2026-08-16 after a viewer switched films mid-stream. """ @@ -86,12 +87,21 @@ def test_closing_a_session_releases_its_tasks(session): assert "gather" in fn, "cancelling without awaiting does not run the exits" -def test_two_slots_is_the_whole_margin(source): - """States the number the failure hinged on, so a change is deliberate.""" +def test_the_slot_count_matches_what_a_slot_now_costs(source): + """States the number, so a change is deliberate rather than drifted into. + + It was two, and two was right while a stream was a burst: the client took + segments as fast as it could append them and the slot came back within the + minute. Bounding the read-ahead to ninety seconds of film (the buffer + ceiling fix) changed what a slot is — it is now held for as long as someone + is watching, so the count is a count of simultaneous viewers. + """ n = int(re.search(r"MAX_CONCURRENT_TRANSCODES\s*=\s*(\d+)", source).group(1)) - assert n == 2, ( - f"the cap is now {n}; the leak above emptied it in {n} abandoned " - "streams, so if this moves the comments explaining it should too") + assert n >= 8, ( + f"the cap is {n}; with a slot held for the length of a film, that is " + f"{n} people watching before the node refuses everyone else") + assert "for as long as the film runs" in source, ( + "the number moved but the comment explaining what a slot costs did not") # ── One viewer, one stream ──────────────────────────────────────────────────── |