Skip to content

Commit

Permalink
Prevent fast looping fetching azure messages (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
cameron-dunn-sublime authored Jul 10, 2024
1 parent 9450dc5 commit 6eedd0e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion v1/brokers/azure/storage_queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,15 @@ func (b *Broker) StartConsuming(consumerTag string, concurrency iface.Resizeable
output, err := b.receiveMessage()
if err == nil && len(output.Messages) > 0 {
deliveries <- output

} else {
if err != nil {
log.ERROR.Printf("Queue consume error on %s: %s", b.queueName, err)
if badRequestErrRegex.MatchString(err.Error()) {
time.Sleep(30 * time.Second)
}
} else {
// No messages, prevent fast looping
time.Sleep(100 * time.Millisecond)
}
//return back to pool right away
concurrency.Return()
Expand Down

0 comments on commit 6eedd0e

Please sign in to comment.