Skip to content

Commit

Permalink
Removed SIGHUP handler on win32. (#334)
Browse files Browse the repository at this point in the history
  • Loading branch information
s3rius authored Jun 14, 2024
1 parent cdb431b commit c289701
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion docs/guide/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ To enable this option simply pass the `--reload` or `-r` option to worker taskiq
Also this option supports `.gitignore` files. If you have such file in your directory, it won't reload worker
when you modify ignored files. To disable this functionality pass `--do-not-use-gitignore` option.

### Graceful reload
### Graceful reload (available only on Unix systems)

To perform graceful reload, send `SIGHUP` signal to the main worker process. This action will reload all workers with new code. It's useful for deployment that requires zero downtime, but don't use orchestration tools like Kubernetes.

Expand Down
10 changes: 6 additions & 4 deletions taskiq/cli/worker/process_manager.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import logging
import signal
import sys
from contextlib import suppress
from dataclasses import dataclass
from multiprocessing import Event, Process, Queue, current_process
Expand Down Expand Up @@ -174,10 +175,11 @@ def __init__(
shutdown_handler = get_signal_handler(self.action_queue, ShutdownAction())
signal.signal(signal.SIGINT, shutdown_handler)
signal.signal(signal.SIGTERM, shutdown_handler)
signal.signal(
signal.SIGHUP,
get_signal_handler(self.action_queue, ReloadAllAction()),
)
if sys.platform != "win32":
signal.signal(
signal.SIGHUP,
get_signal_handler(self.action_queue, ReloadAllAction()),
)

self.workers: List[Process] = []

Expand Down

0 comments on commit c289701

Please sign in to comment.