Skip to content

Commit 3d30cd8

Browse files
committed
Main thread lock: add double-check
1 parent 024c047 commit 3d30cd8

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

reportportal_client/core/worker.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,10 +179,14 @@ def __perform_stop(self, stop_command):
179179
if not self.is_alive():
180180
# Already stopped or already dead or not even started
181181
return
182-
# Do not release main thread until worker process all requests, since
183-
# main thread might forcibly quit python interpreter
184182
with self._stop_lock:
183+
if not self.is_alive():
184+
# Already stopped by previous thread
185+
return
185186
self.send(stop_command)
187+
# Do not release main thread until worker process all requests,
188+
# since main thread might forcibly quit python interpreter as in
189+
# pytest
186190
self._stop_lock.wait(THREAD_TIMEOUT)
187191

188192
def stop(self):

0 commit comments

Comments
 (0)