[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

This commit is contained in:
Piotr Biernat 2020-09-30 22:13:46 +02:00
parent f0bb9cf00d
commit bb61e95c17
2 changed files with 2 additions and 1 deletions

View File

@ -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)
} }

View File

@ -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