mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2025-12-16 12:16:16 +01:00
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:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user