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() {
|
||||
for d := range msgs {
|
||||
log.Printf("Received a message: %s", d.Body)
|
||||
d.Ack(false)
|
||||
dot_count := bytes.Count(d.Body, []byte("."))
|
||||
t := time.Duration(dot_count)
|
||||
time.Sleep(t * time.Second)
|
||||
log.Printf("Done")
|
||||
d.Ack(false)
|
||||
}
|
||||
}()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user