(jobId)
| 256 | } |
| 257 | |
| 258 | function startJobPolling(jobId) { |
| 259 | stopJobPolling(); |
| 260 | const tick = async () => { |
| 261 | try { |
| 262 | const s = await probeJob(jobId); |
| 263 | if (TERMINAL_STATUSES.has(s.status)) stopJobPolling(); |
| 264 | } catch (err) { |
| 265 | console.warn("[job] REST fallback failed:", err); |
| 266 | } |
| 267 | }; |
| 268 | tick(); |
| 269 | jobPollTimerId = setInterval(tick, 1000); |
| 270 | } |
| 271 | |
| 272 | // Connect (or reconnect) to the SSE stream for a job. On unexpected |
| 273 | // disconnect we probe /api/jobs/{id} to decide: if the job is already |
no test coverage detected