diff options
author | Valery Piashchynski <[email protected]> | 2021-08-10 19:54:03 +0300 |
---|---|---|
committer | Valery Piashchynski <[email protected]> | 2021-08-10 19:54:03 +0300 |
commit | a8a7f4194156440ef3157d8e5d75c43ed0327bcf (patch) | |
tree | 9bc4240fb3c6f02682420689490f56d681d4b545 /plugins/jobs/plugin.go | |
parent | d379c28a1e9babead0266bc4fa10d6c5e7aa14cb (diff) |
Add jobs protocol support for the AMQP driver
Signed-off-by: Valery Piashchynski <[email protected]>
Diffstat (limited to 'plugins/jobs/plugin.go')
-rw-r--r-- | plugins/jobs/plugin.go | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/plugins/jobs/plugin.go b/plugins/jobs/plugin.go index 61936db2..c9bba1c2 100644 --- a/plugins/jobs/plugin.go +++ b/plugins/jobs/plugin.go @@ -195,7 +195,7 @@ func (p *Plugin) Serve() chan error { //nolint:gocognit for { select { case <-p.stopCh: - p.log.Debug("------> job poller stopped <------") + p.log.Info("------> job poller stopped <------") return default: // get prioritized JOB from the queue @@ -240,6 +240,16 @@ func (p *Plugin) Serve() chan error { //nolint:gocognit continue } + // if response is nil or body is nil, just acknowledge the job + if resp == nil || resp.Body == nil { + p.putPayload(exec) + err = jb.Ack() + if err != nil { + p.log.Error("acknowledge error, job might be missed", "error", err) + continue + } + } + // handle the response protocol err = handleResponse(resp.Body, jb, p.log) if err != nil { |