diff options
Diffstat (limited to 'plugins/jobs/plugin.go')
-rw-r--r-- | plugins/jobs/plugin.go | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/plugins/jobs/plugin.go b/plugins/jobs/plugin.go index 83b302ee..3f3fa196 100644 --- a/plugins/jobs/plugin.go +++ b/plugins/jobs/plugin.go @@ -342,10 +342,6 @@ func (p *Plugin) Stop() error { cancel() } - p.Lock() - p.workersPool.Destroy(context.Background()) - p.Unlock() - // this function can block forever, but we don't care, because we might have a chance to exit from the pollers, // but if not, this is not a problem at all. // The main target is to stop the drivers @@ -358,6 +354,11 @@ func (p *Plugin) Stop() error { // just wait pollers for 5 seconds before exit time.Sleep(time.Second * 5) + + p.Lock() + p.workersPool.Destroy(context.Background()) + p.Unlock() + return nil } |