Skip to content

Commit f1e9358

Browse files
committed
re-add forgotten instruction.
While cleaning up, I forgot to re-add the global_exit_event when processing a hard shutdown.
1 parent ba0442e commit f1e9358

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

PyFunceble/ext/process_manager/core.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1152,6 +1152,9 @@ def terminate(self, *, mode: str = "soft") -> "ProcessManagerCore":
11521152
"%s-manager | Forcefully terminating all workers.", self.STD_NAME
11531153
)
11541154

1155+
# Instruct the workers to terminate themselves.
1156+
self.global_exit_event.set()
1157+
11551158
for worker in set(self.running_workers + self.created_workers):
11561159
self.terminate_worker(worker)
11571160

tests/test_process_core.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -509,8 +509,14 @@ def test_terminate_hard(process_manager):
509509

510510
assert len(process_manager.created_workers) == 2
511511

512+
assert process_manager.global_exit_event.is_set() is False
513+
assert process_manager.terminating_event.is_set() is False
514+
512515
process_manager.terminate(mode="hard")
513516

517+
assert process_manager.global_exit_event.is_set() is True
518+
assert process_manager.terminating_event.is_set() is True
519+
514520
# In the hard mode, we terminate all workers without waiting for them to finish.
515521
worker1.terminate.assert_called_once()
516522
worker2.terminate.assert_called_once()

0 commit comments

Comments
 (0)