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:
1 parent
883d85e91d
commit
462da5c225
1 file changed
+1
-1
@@ -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.
|
// 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
|
let pending: { to: number; text: Promise<Buffer> } | null = null
|
||||||
for await (const frame of decodeFrames(await api.stream(range.id))) {
|
for await (const frame of decodeFrames(await api.stream(range.id))) {
|
||||||
|
if (this.stopping) break
|
||||||
if (isKeepalive(frame)) continue
|
if (isKeepalive(frame)) continue
|
||||||
const next = { to: frame.to, text: unzipAsync(frame.data) }
|
const next = { to: frame.to, text: unzipAsync(frame.data) }
|
||||||
next.text.catch(() => {})
|
next.text.catch(() => {})
|
||||||
if (pending) await handle(pending)
|
if (pending) await handle(pending)
|
||||||
pending = next
|
pending = next
|
||||||
if (this.stopping) break
|
|
||||||
}
|
}
|
||||||
if (pending && !this.stopping) await handle(pending)
|
if (pending && !this.stopping) await handle(pending)
|
||||||
await posting
|
await posting
|
||||||
|
|||||||
Reference in new issue
Block a user