We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2cce696 commit 3f4fad8Copy full SHA for 3f4fad8
src/amplitude/worker.py
@@ -37,11 +37,12 @@ def stop(self):
37
38
def flush(self):
39
futures = []
40
- while self.storage.total_events:
41
- events = self.storage.pull(self.configuration.flush_queue_size)
42
- if events:
43
- future = self.threads_pool.submit(self.send, events)
44
- futures.append(future)
+ with self.storage.lock:
+ while self.storage.total_events:
+ events = self.storage.pull(self.configuration.flush_queue_size)
+ if events:
+ future = self.threads_pool.submit(self.send, events)
45
+ futures.append(future)
46
return futures
47
48
def send(self, events):
0 commit comments