Skip to content

Commit

Permalink
Fix reset variables in thread safe way.
Browse files Browse the repository at this point in the history
  • Loading branch information
jovany-wang committed Jul 5, 2023
1 parent 204a0a3 commit fcdb0a3
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions fed/cleanup.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,6 @@ def _signal_exit():
break

logger.info('Check sending thread was exited.')
global _check_send_thread
_check_send_thread = None
logger.info('Clearing sending queue.')
_sending_obj_refs_q = None


def _main_thread_monitor():
Expand Down Expand Up @@ -117,3 +113,9 @@ def wait_sending():
if _check_send_thread:
notify_to_exit()
_check_send_thread.join()
_check_send_thread = None

# It's safe to reset `_sending_obj_refs_q` as another
# thread is stoped.
global _sending_obj_refs_q
_sending_obj_refs_q = None

0 comments on commit fcdb0a3

Please sign in to comment.