Use durable log spool in worker entrypoint

This commit is contained in:
npc0-hue
2026-09-02 10:27:45 +08:00
parent cea5f89fa6
commit 386a295f20
+8 -3
View File
@@ -73,13 +73,18 @@ func main() {
os.Exit(1)
}
log.Printf("RUN phase=artifact_queue status=ready path=%s", diagnosticValue(cfg.SpoolRoot))
liveLogSink := runruntime.NewLiveLogSink(client)
defer liveLogSink.Close()
log.Printf("RUN phase=log_spool status=opening path=%s", diagnosticValue(cfg.SpoolRoot))
logSpool, err := spool.NewLogSpool(cfg.SpoolRoot)
if err != nil {
fmt.Fprintf(os.Stderr, "initialize log spool: %v\n", err)
os.Exit(1)
}
log.Printf("RUN phase=log_spool status=ready path=%s", diagnosticValue(cfg.SpoolRoot))
log.Printf("RUN phase=worker_init status=starting endpoint=%s", diagnosticValue(cfg.RunEndpointID))
worker, err := runruntime.NewWorker(
cfg,
client,
runruntime.WithProcessLogSink(liveLogSink),
runruntime.WithProcessLogSink(&runruntime.SpoolLogSink{Spool: logSpool}),
runruntime.WithLifecycleArtifactHook(&runruntime.QueueArtifactHook{Queue: artifactQueue}),
)
if err != nil {