File tree Expand file tree Collapse file tree 1 file changed +14
-10
lines changed
Expand file tree Collapse file tree 1 file changed +14
-10
lines changed Original file line number Diff line number Diff line change @@ -168,16 +168,20 @@ def flush(self) -> None:
168168 payload = json .dumps (
169169 {"events" : events , "environment_key" : self ._environment_key }
170170 )
171- future = session .post (
172- self ._batch_endpoint ,
173- data = payload ,
174- timeout = 3 ,
175- headers = {
176- "Content-Type" : "application/json; charset=utf-8" ,
177- "X-Environment-Key" : self ._environment_key ,
178- "Flagsmith-SDK-User-Agent" : f"flagsmith-python-client/{ __version__ } " ,
179- },
180- )
171+ try :
172+ future = session .post (
173+ self ._batch_endpoint ,
174+ data = payload ,
175+ timeout = 3 ,
176+ headers = {
177+ "Content-Type" : "application/json; charset=utf-8" ,
178+ "X-Environment-Key" : self ._environment_key ,
179+ "Flagsmith-SDK-User-Agent" : f"flagsmith-python-client/{ __version__ } " ,
180+ },
181+ )
182+ except RuntimeError :
183+ logger .debug ("Skipping flush: thread pool already shut down" )
184+ return
181185 future .add_done_callback (lambda f : self ._handle_flush_result (f , events ))
182186
183187 def _handle_flush_result (
You can’t perform that action at this time.
0 commit comments