librato / python-librato

A Python wrapper for the Librato Metrics API.
Other
72 stars 31 forks source link

race condition in queue.submit() #178

Open fracai opened 1 year ago

fracai commented 1 year ago

queue.submit() iterates over chunks, sends each, and then resets the chunks. This can be a problem if any process adds items to the queue while submit() is iterating. When that happens, the new additions can be cleared out before they can be sent.

An alternative is to repeatedly pop the first chunk while the chunks aren't empty. I'll open a pull request.