[Azure Storage Queue] receive_messages infinite loop
See original GitHub issue- Package Name:
- Package Version:
- Operating System:
- Python Version:
Describe the bug It is not a bug, more like really unexpected behavior.
Azure Storage Queue receive_messages doesn’t have a way to define maximum number of messages to receive. If it is ever used against the queue that constantly gets new messages, it will just stuck in an infinite loop because it will try to query extra messages.
If it runs in a serverless environment, where execution is limited by time, it will lead to potential data loss when function is killed.
There is a workaround for this, but it is not obvious from the method description that it will continuously look for messages instead of dequeuing all available or X…
messages = queue_service.receive_messages()
try:
return [m for m in messages.by_page().next()]
except StopIteration:
return []
To Reproduce Steps to reproduce the behavior: 1.
Expected behavior A clear and concise description of what you expected to happen.
Screenshots If applicable, add screenshots to help explain your problem.
Additional context Add any other context about the problem here.
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (5 by maintainers)

Top Related StackOverflow Question
@tasherif-msft ping
@amishra-dev, it looks like this needs more investigation to come up with the right solution. I will investigate.