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

Add a restart mechanism to all workers in the multiplexer #2622

Merged
merged 5 commits into from Dec 11, 2022
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 7 additions & 2 deletions sanic/worker/multiplexer.py
Expand Up @@ -21,9 +21,14 @@ def ack(self):
"state": ProcessState.ACKED.name,
}

def restart(self, name: str = ""):
def restart(self, name: str = "", all_workers: bool = False):
if name and all_workers:
raise ValueError(
"Ambiguous restart with both a named process and"
" all_workers=True"
)
if not name:
name = self.name
name = "__ALL_PROCESSES__:" if all_workers else self.name
self._monitor_publisher.send(name)

reload = restart # no cov
Expand Down