Commit f844ca79 authored by Jérome Perrin's avatar Jérome Perrin

WSGI: Start timerserver from wsgi script

This is a step to be able to run ERP5 on zope4, where servers are no longer started by ZConfig.

This will be used by nexedi/slapos!1114

See merge request nexedi/erp5!1529
parents b092cb06 9fc3cf28
...@@ -158,6 +158,7 @@ def runwsgi(): ...@@ -158,6 +158,7 @@ def runwsgi():
parser.add_argument('-w', '--webdav', action='store_true') parser.add_argument('-w', '--webdav', action='store_true')
parser.add_argument('address', help='<ip>:<port>') parser.add_argument('address', help='<ip>:<port>')
parser.add_argument('zope_conf', help='path to zope.conf') parser.add_argument('zope_conf', help='path to zope.conf')
parser.add_argument('--timerserver-interval', help='Interval for timerserver', type=float)
args = parser.parse_args() args = parser.parse_args()
startup = os.path.dirname(Zope2.Startup.__file__) startup = os.path.dirname(Zope2.Startup.__file__)
...@@ -169,6 +170,13 @@ def runwsgi(): ...@@ -169,6 +170,13 @@ def runwsgi():
from Signals.SignalHandler import SignalHandler from Signals.SignalHandler import SignalHandler
SignalHandler.registerHandler(signal.SIGTERM, sys.exit) SignalHandler.registerHandler(signal.SIGTERM, sys.exit)
if args.timerserver_interval:
import Products.TimerService
Products.TimerService.timerserver.TimerServer.TimerServer(
module='Zope2',
interval=args.timerserver_interval,
)
ip, port = splitport(args.address) ip, port = splitport(args.address)
port = int(port) port = int(port)
createServer( createServer(
......
...@@ -101,8 +101,8 @@ class TimerServer(threading.Thread): ...@@ -101,8 +101,8 @@ class TimerServer(threading.Thread):
err = StringIO() err = StringIO()
response = TimerResponse(out, err) response = TimerResponse(out, err)
handle(module, TimerRequest(response, interval), response) handle(module, TimerRequest(response, interval), response)
except: except Exception:
pass logger.warn("Ignoring exception in run loop", exc_info=True)
TIMER_SERVICE_PATH = '/Control_Panel/timer_service' TIMER_SERVICE_PATH = '/Control_Panel/timer_service'
...@@ -110,7 +110,7 @@ TIMER_ENVIRON = { ...@@ -110,7 +110,7 @@ TIMER_ENVIRON = {
'REQUEST_METHOD': 'GET', 'REQUEST_METHOD': 'GET',
'SERVER_SOFTWARE': 'TimerServer for Zope', 'SERVER_SOFTWARE': 'TimerServer for Zope',
'SERVER_NAME': '', 'SERVER_NAME': '',
'SERVER_PORT': '', 'SERVER_PORT': '-1',
'REMOTE_ADDR': '', 'REMOTE_ADDR': '',
'GATEWAY_INTERFACE': 'CGI/1.1', 'GATEWAY_INTERFACE': 'CGI/1.1',
'SERVER_PROTOCOL': 'HTTP/1.0', 'SERVER_PROTOCOL': 'HTTP/1.0',
......
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