Commit 7f26d3e6 authored by Jérome Perrin's avatar Jérome Perrin Committed by Cédric Le Ninivin

zopewsgi: start TimerServer from startup script

When running with ZServer, TimerServer will be started by ZConfig
machinery, because ZServer comes with some ZConfig data types for server
factory which start servers.

One Zope 2, ZServer was imported from zopeschema:

https://github.com/zopefoundation/Zope/blob/2.13.30/src/Zope2/Startup/zopeschema.xml#L10

and ZConfig used the TimerServerFactory to create a TimerService.

On Zope 4, ZServer is not imported anymore in the new wsgischema:

https://github.com/zopefoundation/Zope/blob/4.6.3/src/Zope2/Startup/wsgischema.xml

so the ZConfig data type can not be used to create the server.

Instead of relying on ZServer's ZConfig, we create the server directly
from the startup script, the logic to attach to waitress is already here
and startup and factory just called create, so the only difference is
that we no longer use zope.conf to configure TimerService, but configure
from the script.

SlapOS profile also needs to be modified in order to not include ZConfig
bits for timerserver and to pass the timerserver interval in the wrapper
to this script.
parent 8656361c
......@@ -158,6 +158,7 @@ def runwsgi():
parser.add_argument('-w', '--webdav', action='store_true')
parser.add_argument('address', help='<ip>:<port>')
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()
startup = os.path.dirname(Zope2.Startup.__file__)
......@@ -169,6 +170,13 @@ def runwsgi():
from Signals.SignalHandler import SignalHandler
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)
port = int(port)
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