Skip to content

Commit 7743a37

Browse files
committed
feat: use-at-exit-to-flush-analytics-on-process-exit
1 parent 55df6eb commit 7743a37

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

flagsmith/analytics.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import atexit
12
import json
23
import logging
34
import threading
@@ -210,8 +211,10 @@ def _handle_flush_result(
210211

211212
def start(self) -> None:
212213
self._schedule_flush()
214+
atexit.register(self.stop)
213215

214216
def stop(self) -> None:
217+
atexit.unregister(self.stop)
215218
if self._timer is not None:
216219
self._timer.cancel()
217220
self.flush()

0 commit comments

Comments
 (0)