Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed SIGHUP handler on win32. #334

Merged
merged 1 commit into from
Jun 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading