diff --git a/fed/cleanup.py b/fed/cleanup.py index a770094..8e543c0 100644 --- a/fed/cleanup.py +++ b/fed/cleanup.py @@ -110,12 +110,13 @@ def notify_to_exit(): def wait_sending(): global _check_send_thread - if _check_send_thread: + if _check_send_thread is not None: notify_to_exit() _check_send_thread.join() _check_send_thread = None + global _sending_obj_refs_q + if _sending_obj_refs_q is not 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 diff --git a/tests/test_repeat_init.py b/tests/test_repeat_init.py index 42eaa74..2f6e9d5 100644 --- a/tests/test_repeat_init.py +++ b/tests/test_repeat_init.py @@ -51,13 +51,6 @@ def _run(): assert fed.cleanup._sending_obj_refs_q is None compatible_utils.init_ray(address='local') fed.init(cluster=cluster, party=party) - _start_check_sending() - time.sleep(0.5) - assert fed.cleanup._sending_obj_refs_q is not None - push_to_sending(True) - # Slightly longer than the queue polling - time.sleep(0.6) - assert fed.cleanup._sending_obj_refs_q is None my1 = My.party("alice").remote() my2 = My.party("bob").remote()