[fix] Manually mark queue as done after task finishes. Now we dont lose task, even if worker crash.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
f0bb9cf00d
commit
bb61e95c17
@ -20,4 +20,5 @@ func callback(d amqp.Delivery) {
|
|||||||
log.Println("Received message: ", string(d.Body))
|
log.Println("Received message: ", string(d.Body))
|
||||||
time.Sleep(5 * time.Second)
|
time.Sleep(5 * time.Second)
|
||||||
log.Println("Finished!")
|
log.Println("Finished!")
|
||||||
|
d.Ack(false)
|
||||||
}
|
}
|
||||||
|
@ -84,7 +84,7 @@ func (a *AMQP) Consume(queueName string, callback func(d amqp.Delivery)) {
|
|||||||
msgs, a.err = a.chn.Consume(
|
msgs, a.err = a.chn.Consume(
|
||||||
queueName, // queue
|
queueName, // queue
|
||||||
"", // consumer
|
"", // consumer
|
||||||
true, // auto-ack
|
false, // auto-ack
|
||||||
false, // exclusive
|
false, // exclusive
|
||||||
false, // no-local
|
false, // no-local
|
||||||
false, // no-wait
|
false, // no-wait
|
||||||
|
Loading…
Reference in New Issue
Block a user