From 4e79d2d4d037e7c33ec3e63d58110668106de222 Mon Sep 17 00:00:00 2001 From: Chris Date: Fri, 29 Sep 2017 04:29:29 -0500 Subject: remove jobs.Srv and other jobs-related globals (#7535) --- jobs/jobs_watcher.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'jobs/jobs_watcher.go') diff --git a/jobs/jobs_watcher.go b/jobs/jobs_watcher.go index 56cf9eb2e..f9a958fe3 100644 --- a/jobs/jobs_watcher.go +++ b/jobs/jobs_watcher.go @@ -16,6 +16,7 @@ const ( ) type Watcher struct { + srv *JobServer workers *Workers stop chan bool @@ -23,12 +24,13 @@ type Watcher struct { pollingInterval int } -func MakeWatcher(workers *Workers, pollingInterval int) *Watcher { +func (srv *JobServer) MakeWatcher(workers *Workers, pollingInterval int) *Watcher { return &Watcher{ stop: make(chan bool, 1), stopped: make(chan bool, 1), pollingInterval: pollingInterval, workers: workers, + srv: srv, } } @@ -63,7 +65,7 @@ func (watcher *Watcher) Stop() { } func (watcher *Watcher) PollAndNotify() { - if result := <-Srv.Store.Job().GetAllByStatus(model.JOB_STATUS_PENDING); result.Err != nil { + if result := <-watcher.srv.Store.Job().GetAllByStatus(model.JOB_STATUS_PENDING); result.Err != nil { l4g.Error("Error occured getting all pending statuses: %v", result.Err.Error()) } else { jobs := result.Data.([]*model.Job) -- cgit v1.2.3-1-g7c22