Commit e003c9bc authored by Bryton Lacquement's avatar Bryton Lacquement 🚪

WSGI: capture SIGTERM to properly shutdown the server

parent 68cabf53
...@@ -3,7 +3,9 @@ from io import BytesIO ...@@ -3,7 +3,9 @@ from io import BytesIO
import logging import logging
import os import os
import posixpath import posixpath
import signal
import socket import socket
import sys
from tempfile import TemporaryFile from tempfile import TemporaryFile
import time import time
from urllib import quote, splitport from urllib import quote, splitport
...@@ -160,6 +162,9 @@ def runwsgi(): ...@@ -160,6 +162,9 @@ def runwsgi():
make_wsgi_app({}, zope_conf=args.zope_conf) make_wsgi_app({}, zope_conf=args.zope_conf)
from Signals.SignalHandler import SignalHandler
SignalHandler.registerHandler(signal.SIGTERM, sys.exit)
ip, port = splitport(args.address) ip, port = splitport(args.address)
port = int(port) port = int(port)
createServer( createServer(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment