Rebuild: a stopping worker notices it on keep-alive frames too

It checked only after a data frame, so a worker waiting for its range's
spool (keep-alive frames only) never stopped on SIGTERM.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Daan MeijerandClaude Opus 5.5 committed 2026-10-09 03:26:20 +02:00
1 parent 883d85e91d
commit 462da5c225
1 file changed
+1 -1
+1 -1
View File
@@ -148,12 +148,12 @@ export default class EdgeNode extends BaseCommand {
// Inflating runs on a thread-pool thread: the next chunk inflates while this one is indexed.
let pending: { to: number; text: Promise<Buffer> } | null = null
for await (const frame of decodeFrames(await api.stream(range.id))) {
if (this.stopping) break
if (isKeepalive(frame)) continue
const next = { to: frame.to, text: unzipAsync(frame.data) }
next.text.catch(() => {})
if (pending) await handle(pending)
pending = next
if (this.stopping) break
}
if (pending && !this.stopping) await handle(pending)
await posting