-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This is similar to worker_exit() in that it is called just after a worker has terminated, but it's called in the Gunicorn *master* process, not the *child* process.
- Loading branch information
Showing
3 changed files
with
35 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1634,6 +1634,23 @@ def post_request(worker, req, environ, resp): | |
""" | ||
|
||
|
||
class ChildExit(Setting): | ||
name = "child_exit" | ||
section = "Server Hooks" | ||
validator = validate_callable(2) | ||
type = six.callable | ||
|
||
def child_exit(server, worker): | ||
pass | ||
default = staticmethod(child_exit) | ||
desc = """\ | ||
Called just after a worker has been exited, in the master process. | ||
The callable needs to accept two instance variables for the Arbiter and | ||
the just-exited Worker. | ||
""" | ||
|
||
|
||
class WorkerExit(Setting): | ||
name = "worker_exit" | ||
section = "Server Hooks" | ||
|
@@ -1644,7 +1661,7 @@ def worker_exit(server, worker): | |
pass | ||
default = staticmethod(worker_exit) | ||
desc = """\ | ||
Called just after a worker has been exited. | ||
Called just after a worker has been exited, in the worker process. | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
tilgovi
Collaborator
|
||
The callable needs to accept two instance variables for the Arbiter and | ||
the just-exited Worker. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
It seems that this is accurate, but incomplete. worker_exit is called both in the worker process, and in the parent when killing a worker.