mirror of
https://github.com/rommapp/romm.git
synced 2026-12-06 15:54:45 +01:00
fix(streaming): report only the ended notice of the claim a poll names
A desktop re-claim leaves the last claim's notice in place, and a pool can hold one per container, so a stamped poll or heartbeat could show another claim's ended-by and reason.
This commit is contained in:
2 files changed
+25
-2
No files matched your search
@@ -243,8 +243,10 @@ async def _session_status(
|
||||
termination = None
|
||||
for candidate in candidates:
|
||||
notice = await get_termination(candidate.key, request.user.id)
|
||||
if notice is not None and access.notice_in_scope(
|
||||
notice, platform, include_desktop
|
||||
if (
|
||||
notice is not None
|
||||
and access.notice_in_scope(notice, platform, include_desktop)
|
||||
and (claimed_at is None or notice.get("claimed_at") == claimed_at)
|
||||
):
|
||||
termination = notice
|
||||
break
|
||||
|
||||
@@ -3071,6 +3071,27 @@ def test_a_termination_notice_names_the_claim_it_ended(
|
||||
assert r.json()["termination"]["claimed_at"] == claimed_at
|
||||
|
||||
|
||||
def test_status_does_not_report_the_notice_of_another_claim(
|
||||
client, access_token, viewer_access_token, rom: Rom
|
||||
):
|
||||
"""A poll names the claim it asks about, so a notice filed for another
|
||||
claim on the container must not tell it who ended its own."""
|
||||
with _streaming(_container_for(rom)):
|
||||
_claim_ok(client, viewer_access_token, rom.id)
|
||||
client.delete(
|
||||
f"/api/streaming/sessions/{rom.platform_slug}",
|
||||
params={"reason": "maintenance window"},
|
||||
headers=_auth(access_token),
|
||||
)
|
||||
r = client.get(
|
||||
f"/api/streaming/sessions/{rom.platform_slug}/status",
|
||||
params={"claimed_at": "2026-09-17T10:05:00+00:00"},
|
||||
headers=_auth(viewer_access_token),
|
||||
)
|
||||
assert r.json()["status"] == "ended"
|
||||
assert r.json()["termination"] is None
|
||||
|
||||
|
||||
def test_a_termination_notice_lands_before_the_drain(
|
||||
client, access_token, viewer_access_token, rom: Rom
|
||||
):
|
||||
|
||||
Reference in new issue
Block a user