()
| 633 | if (extractPoll) { clearInterval(extractPoll); extractPoll = null; } |
| 634 | |
| 635 | const startPolling = () => { |
| 636 | if (extractPoll) return; |
| 637 | extractPoll = setInterval(async () => { |
| 638 | try { |
| 639 | const r = await fetch(`/api/jobs/${jobId}`, { cache: "no-store" }); |
| 640 | if (!r.ok) throw new Error(String(r.status)); |
| 641 | if (_onExtractState(jobId, await r.json())) { clearInterval(extractPoll); extractPoll = null; } |
| 642 | } catch { /* keep polling */ } |
| 643 | }, 2500); |
| 644 | }; |
| 645 | |
| 646 | try { |
| 647 | const es = new EventSource(`/api/jobs/${jobId}/events`); |
no test coverage detected