fix: allow genuinely new playlist ingest without fresh Player evidence
The evidence gate on enqueue_download blocked every download, including a URL that could only land in a slot store.reserve_download already proves is empty and unguarded. After a Controller-only restart with the Player still connected and idle, no fresh detailed status ever arrives, so this could deadlock all new ingest indefinitely even though nothing unsafe would occur. Narrow the gate to only require fresh evidence when the URL already occupies a non-empty slot (refresh/reuse). Deletion, expiry, and cleanup/recovery gating are unchanged.
This commit is contained in:
@@ -98,6 +98,20 @@ class FreshStoreTests(StoreTestCase):
|
||||
self.assertTrue(store.mark_download_running("job-one", 1, 1))
|
||||
self.assertEqual(store.get_slot(1).media_state, "downloading")
|
||||
|
||||
def test_find_occupied_slot_for_url_only_matches_non_empty_slots(self):
|
||||
with self.open_store() as store:
|
||||
url = "https://www.youtube.com/playlist?list=one"
|
||||
self.assertIsNone(store.find_occupied_slot_for_url(url))
|
||||
self.assertIsNone(store.find_occupied_slot_for_url(" "))
|
||||
self.assertIsNone(store.find_occupied_slot_for_url(None))
|
||||
|
||||
store.reserve_download(url, None, None, job_id="job-one")
|
||||
self.assertEqual(store.find_occupied_slot_for_url(url), 1)
|
||||
self.assertEqual(store.find_occupied_slot_for_url(f" {url} "), 1)
|
||||
self.assertIsNone(
|
||||
store.find_occupied_slot_for_url("https://example.test/other")
|
||||
)
|
||||
|
||||
def test_concurrent_requests_get_only_one_remaining_slot(self):
|
||||
with self.open_store() as store:
|
||||
for index in range(1, 10):
|
||||
|
||||
Reference in New Issue
Block a user