Merge the pool's providers in a worker thread #47

Merged
namillis merged 1 commit from feat/merge-worker into main 2026-11-20 16:51:32 +00:00
Owner

After #46 a merge still blocked requests for 2 to 5 s after each provider refresh. The planning (naming streams, grouping them into channels, dropping misfiled guide ids, ordering each channel's streams) now runs in a worker thread. The main thread sends each changed provider's names, categories and guide ids, gets back channel keys and a compact plan (an Int32Array, transferred), and builds the channels in slices of 2,000 that yield to requests. Channels whose streams, guide and catch-up are unchanged are reused as before, merges never overlap, and a failed worker falls back to merging on the main thread.

Checked in the live container against the real 15 providers (295k streams, 161,669 channels): identical channels to the current merge on the first merge and after happy8k and sonymax refreshes (0 differences). Longest main-thread block: 75-80 ms for an unchanged merge or a small refresh, 533 ms for the first merge at startup (was 12.6 s). 143 tests pass.

After #46 a merge still blocked requests for 2 to 5 s after each provider refresh. The planning (naming streams, grouping them into channels, dropping misfiled guide ids, ordering each channel's streams) now runs in a worker thread. The main thread sends each changed provider's names, categories and guide ids, gets back channel keys and a compact plan (an Int32Array, transferred), and builds the channels in slices of 2,000 that yield to requests. Channels whose streams, guide and catch-up are unchanged are reused as before, merges never overlap, and a failed worker falls back to merging on the main thread. Checked in the live container against the real 15 providers (295k streams, 161,669 channels): identical channels to the current merge on the first merge and after happy8k and sonymax refreshes (0 differences). Longest main-thread block: 75-80 ms for an unchanged merge or a small refresh, 533 ms for the first merge at startup (was 12.6 s). 143 tests pass.
Merge the pool's providers in a worker thread
All checks were successful
CI / test (pull_request) Successful in 21s
50b91e1e4e
A merge still blocked requests for 2 to 5 s after each provider refresh. Naming each stream (channel key,
quality, guide key), grouping streams into channels, dropping misfiled guide ids and ordering each channel's
streams now run in a worker thread (mergePlan.js, mergeWorker.js). The main thread builds the channels from the
worker's plan in slices that let requests through, and switches to them at once. If the worker fails, the pool
merges on the main thread as before.
namillis deleted branch feat/merge-worker 2026-11-20 16:51:32 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
namillis/iptv-pool!47
No description provided.