Fix: Busywait loop in archiver and slow shutdown

Remove unblocking default in select
Add shutdown handler with context and timeout
This commit is contained in:
2025-12-11 09:29:10 +01:00
parent 6325793902
commit 8d44ac90ad
7 changed files with 397 additions and 17 deletions

View File

@@ -325,7 +325,7 @@ func runServer(ctx context.Context) error {
}
// Start archiver and task manager
archiver.Start(repository.GetJobRepository())
archiver.Start(repository.GetJobRepository(), ctx)
taskManager.Start(ccconf.GetPackageConfig("cron"), ccconf.GetPackageConfig("archive"))
// Initialize web UI

View File

@@ -373,6 +373,8 @@ func (s *Server) Shutdown(ctx context.Context) {
memorystore.Shutdown()
}
// Then, wait for any async archivings still pending...
archiver.WaitForArchiving()
// Shutdown archiver with 10 second timeout for fast shutdown
if err := archiver.Shutdown(10 * time.Second); err != nil {
cclog.Warnf("Archiver shutdown: %v", err)
}
}