diff options
author | Chris <ccbrown112@gmail.com> | 2017-09-29 04:29:29 -0500 |
---|---|---|
committer | George Goldberg <george@gberg.me> | 2017-09-29 10:29:29 +0100 |
commit | 4e79d2d4d037e7c33ec3e63d58110668106de222 (patch) | |
tree | 038995734b4b78cf025b47d2320d7e324eb80e0c /jobs/jobs_watcher.go | |
parent | cb33179998c682bf1e48795d449d85f92cec97f7 (diff) | |
download | chat-4e79d2d4d037e7c33ec3e63d58110668106de222.tar.gz chat-4e79d2d4d037e7c33ec3e63d58110668106de222.tar.bz2 chat-4e79d2d4d037e7c33ec3e63d58110668106de222.zip |
remove jobs.Srv and other jobs-related globals (#7535)
Diffstat (limited to 'jobs/jobs_watcher.go')
-rw-r--r-- | jobs/jobs_watcher.go | 6 |
1 files changed, 4 insertions, 2 deletions
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) |