mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat: add provisioner job hang detector (#7927)
This commit is contained in:
+10
-3
@@ -78,6 +78,7 @@ import (
|
||||
"github.com/coder/coder/coderd/schedule"
|
||||
"github.com/coder/coder/coderd/telemetry"
|
||||
"github.com/coder/coder/coderd/tracing"
|
||||
"github.com/coder/coder/coderd/unhanger"
|
||||
"github.com/coder/coder/coderd/updatecheck"
|
||||
"github.com/coder/coder/coderd/util/slice"
|
||||
"github.com/coder/coder/coderd/workspaceapps"
|
||||
@@ -898,11 +899,17 @@ func (r *RootCmd) Server(newAPI func(context.Context, *coderd.Options) (*coderd.
|
||||
return xerrors.Errorf("notify systemd: %w", err)
|
||||
}
|
||||
|
||||
autobuildPoller := time.NewTicker(cfg.AutobuildPollInterval.Value())
|
||||
defer autobuildPoller.Stop()
|
||||
autobuildExecutor := autobuild.NewExecutor(ctx, options.Database, coderAPI.TemplateScheduleStore, logger, autobuildPoller.C)
|
||||
autobuildTicker := time.NewTicker(cfg.AutobuildPollInterval.Value())
|
||||
defer autobuildTicker.Stop()
|
||||
autobuildExecutor := autobuild.NewExecutor(ctx, options.Database, coderAPI.TemplateScheduleStore, logger, autobuildTicker.C)
|
||||
autobuildExecutor.Run()
|
||||
|
||||
hangDetectorTicker := time.NewTicker(cfg.JobHangDetectorInterval.Value())
|
||||
defer hangDetectorTicker.Stop()
|
||||
hangDetector := unhanger.New(ctx, options.Database, options.Pubsub, logger, hangDetectorTicker.C)
|
||||
hangDetector.Start()
|
||||
defer hangDetector.Close()
|
||||
|
||||
// Currently there is no way to ask the server to shut
|
||||
// itself down, so any exit signal will result in a non-zero
|
||||
// exit of the server.
|
||||
|
||||
+3
@@ -148,6 +148,9 @@ networking:
|
||||
# Interval to poll for scheduled workspace builds.
|
||||
# (default: 1m0s, type: duration)
|
||||
autobuildPollInterval: 1m0s
|
||||
# Interval to poll for hung jobs and automatically terminate them.
|
||||
# (default: 1m0s, type: duration)
|
||||
jobHangDetectorInterval: 1m0s
|
||||
introspection:
|
||||
prometheus:
|
||||
# Serve prometheus metrics on the address defined by prometheus address.
|
||||
|
||||
Reference in New Issue
Block a user