MCPcopy
hub / github.com/netdata/netdata / Start

Method Start

src/go/plugin/framework/jobruntime/job_v1.go:315–346  ·  view source on GitHub ↗

Start starts job main loop.

()

Source from the content-addressed store, hash-verified

313
314// Start starts job main loop.
315func (j *Job) Start() {
316 j.stopCtrl.markStarted()
317 j.running.Store(true)
318 if j.functionOnly {
319 j.Info("started in function-only mode")
320 } else {
321 j.Infof("started, data collection interval %ds", j.updateEvery)
322 }
323 defer func() {
324 j.running.Store(false)
325 j.stopCtrl.markStopped()
326 j.Info("stopped")
327 }()
328
329LOOP:
330 for {
331 select {
332 case <-j.stopCtrl.stopCh:
333 break LOOP
334 case t := <-j.tick:
335 if !j.functionOnly && j.shouldCollect(t) {
336 markRunStartWithResumeLog(&j.skipTracker, j.Logger)
337
338 j.runOnce()
339
340 j.skipTracker.MarkRunStop(time.Now())
341 }
342 }
343 }
344 j.module.Cleanup(context.TODO())
345 j.Cleanup()
346}
347
348// Stop stops job main loop. It blocks until the job is stopped.
349func (j *Job) Stop() {

Callers

nothing calls this directly

Calls 11

shouldCollectMethod · 0.95
runOnceMethod · 0.95
CleanupMethod · 0.95
markStartedMethod · 0.80
StoreMethod · 0.80
markStoppedMethod · 0.80
MarkRunStopMethod · 0.80
InfoMethod · 0.65
InfofMethod · 0.65
CleanupMethod · 0.65

Tested by

no test coverage detected