-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add middleware that apps can use to handle graceful timeout signal
uwsgi 2.0.22+ offers option to send a user-defined signal at for a "graceful" timeout before the real harakiri occurs. gunicorn sends SIGABRT (signal 6) as graceful timeout signal before sending SIGKILL. Apps can use this middleware to log a traceback indicating what code was executing when the graceful timeout signal was received.
- Loading branch information
Showing
4 changed files
with
34 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
from ansible_base.lib.middleware.logging.log_request import LogRequestMiddleware | ||
from ansible_base.lib.middleware.logging.log_request import LogRequestMiddleware, LogTracebackMiddleware | ||
|
||
__all__ = ('LogRequestMiddleware',) | ||
__all__ = ('LogRequestMiddleware', 'LogTracebackMiddleware') |
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 |
---|---|---|
@@ -1,6 +1,14 @@ | ||
import signal | ||
|
||
from django.apps import AppConfig | ||
|
||
from ansible_base.lib.middleware.logging import LogTracebackMiddleware | ||
|
||
|
||
class TestAppConfig(AppConfig): | ||
default_auto_field = 'django.db.models.BigAutoField' | ||
name = 'test_app' | ||
|
||
def ready(self): | ||
super().ready() | ||
signal.signal(signal.SIGSYS, LogTracebackMiddleware.handle_signal) |
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