Bogdanp / dramatiq_sqs

A Dramatiq broker that can be used with Amazon SQS.
https://dramatiq.io
Other
56 stars 21 forks source link

Add progressive sleep if no messages are received from SQS #5

Closed flyudvik closed 4 years ago

flyudvik commented 4 years ago

using this package I encountered an issue of my CPU running 100% when no messages returned from SQS. So for this reason I've added the time.sleep on example of dramatiq.brokers.redis

Bogdanp commented 4 years ago

Hi @flyudvik, are you sure you diagnosed the problem correctly on your end? The SQS endpoint for receiving messages holds the connection open for up to 20 seconds if there aren't any messages on the queue so this should be unnecessary.

See https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-short-and-long-polling.html#sqs-long-polling

Did you by any chance set the DRAMATIQ_SQS_MIN_TIMEOUT environment variable to something other than 20?

Bogdanp commented 4 years ago

I've closed this since it's been a while. Feel free to re-open if you have more info!