MCPcopy Index your code
hub / github.com/coder/coder / New

Function New

coderd/jobreaper/detector.go:113–127  ·  view source on GitHub ↗

New returns a new job reaper.

(ctx context.Context, db database.Store, pub pubsub.Pubsub, log slog.Logger, tick <-chan time.Time)

Source from the content-addressed store, hash-verified

111
112// New returns a new job reaper.
113func New(ctx context.Context, db database.Store, pub pubsub.Pubsub, log slog.Logger, tick <-chan time.Time) *Detector {
114 //nolint:gocritic // Job reaper has a limited set of permissions.
115 ctx, cancel := context.WithCancel(dbauthz.AsJobReaper(ctx))
116 d := &Detector{
117 ctx: ctx,
118 cancel: cancel,
119 done: make(chan struct{}),
120 db: db,
121 pubsub: pub,
122 log: log,
123 tick: tick,
124 stats: nil,
125 }
126 return d
127}
128
129// WithStatsChannel will cause Executor to push a RunStats to ch after
130// every tick. This push is blocking, so if ch is not read, the detector will

Callers 3

NewOptionsFunction · 0.92
newDetectorTestEnvFunction · 0.92
ServerMethod · 0.92

Calls 1

AsJobReaperFunction · 0.92

Tested by 1

newDetectorTestEnvFunction · 0.74