mirror of
https://github.com/4gray/iptvnator.git
synced 2026-10-11 02:46:16 -08:00
* fix(epg): dedupe concurrent fetches and await worker termination Two concurrent fetchEpgFromUrl calls for the same URL spawned two workers parsing and writing the same EPG data, with the second one overwriting the first one's entry in the workers map and leaking that worker. Share the in-flight promise instead of spawning a competitor. worker.terminate() was also fired without awaiting it in every settle path. A terminated-but-still-running worker can keep holding the SQLite lock, blocking the next EPG operation. All settle paths now resolve or reject only after the worker thread has really exited; the settle guard runs first so the worker's own exit event cannot hijack the outcome. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(epg): close review gaps in fetch dedupe and clear sequencing - Check the in-flight map before the fetched-URL shortcut: a completed fetch is added to fetchedUrls while its worker is still terminating, and a concurrent request must keep awaiting that window instead of resolving early. - clearEpgData now resolves only after every interrupted fetch worker has terminated too, not just the clear worker — they may still hold the SQLite lock the caller expects to be free. Addresses Codex/Greptile review feedback on #1040. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> --------- Co-authored-by: 4gray <fourgray@proton.me> Co-authored-by: Claude Fable 5 <noreply@anthropic.com>