Update worker.go
fix: Ack should be an the end of loop.
This commit is contained in:
parent
083b214459
commit
92bcb23944
@ -56,11 +56,11 @@ func main() {
|
|||||||
go func() {
|
go func() {
|
||||||
for d := range msgs {
|
for d := range msgs {
|
||||||
log.Printf("Received a message: %s", d.Body)
|
log.Printf("Received a message: %s", d.Body)
|
||||||
d.Ack(false)
|
|
||||||
dot_count := bytes.Count(d.Body, []byte("."))
|
dot_count := bytes.Count(d.Body, []byte("."))
|
||||||
t := time.Duration(dot_count)
|
t := time.Duration(dot_count)
|
||||||
time.Sleep(t * time.Second)
|
time.Sleep(t * time.Second)
|
||||||
log.Printf("Done")
|
log.Printf("Done")
|
||||||
|
d.Ack(false)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user