Skip to content
This repository has been archived by the owner on Dec 11, 2023. It is now read-only.

fix race condition in queue.submit() #179

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions librato/queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,13 +135,11 @@ def add_aggregator(self, aggregator):
self._auto_submit_if_necessary()

def submit(self):
for c in self.chunks:
self.connection._mexe("metrics", method="POST", query_props=c)
self.chunks = []
while len(self.chunks) > 0:
self.connection._mexe("metrics", method="POST", query_props=self.chunks.pop(0))

for chunk in self.tagged_chunks:
self.connection._mexe("measurements", method="POST", query_props=chunk)
self.tagged_chunks = []
while len(self.tagged_chunks) > 0:
self.connection._mexe("measurements", method="POST", query_props=self.tagged_chunks.pop(0))

def __enter__(self):
return self
Expand Down