Call startup commands as system triggers.

This helps ensures that we only consider ourselves "up" once all the
startup functions have completed.
This commit is contained in:
Erik Johnston 2019-07-22 15:22:14 +01:00
parent 79f689e6c2
commit 80cfad233e
11 changed files with 29 additions and 11 deletions

View file

@ -168,7 +168,9 @@ def start(config_options):
) )
ps.setup() ps.setup()
reactor.callWhenRunning(_base.start, ps, config.worker_listeners) reactor.addSystemEventTrigger(
"before", "startup", _base.start, ps, config.worker_listeners
)
_base.start_worker_reactor("synapse-appservice", config) _base.start_worker_reactor("synapse-appservice", config)

View file

@ -194,7 +194,9 @@ def start(config_options):
) )
ss.setup() ss.setup()
reactor.callWhenRunning(_base.start, ss, config.worker_listeners) reactor.addSystemEventTrigger(
"before", "startup", _base.start, ss, config.worker_listeners
)
_base.start_worker_reactor("synapse-client-reader", config) _base.start_worker_reactor("synapse-client-reader", config)

View file

@ -193,7 +193,9 @@ def start(config_options):
) )
ss.setup() ss.setup()
reactor.callWhenRunning(_base.start, ss, config.worker_listeners) reactor.addSystemEventTrigger(
"before", "startup", _base.start, ss, config.worker_listeners
)
_base.start_worker_reactor("synapse-event-creator", config) _base.start_worker_reactor("synapse-event-creator", config)

View file

@ -175,7 +175,9 @@ def start(config_options):
) )
ss.setup() ss.setup()
reactor.callWhenRunning(_base.start, ss, config.worker_listeners) reactor.addSystemEventTrigger(
"before", "startup", _base.start, ss, config.worker_listeners
)
_base.start_worker_reactor("synapse-federation-reader", config) _base.start_worker_reactor("synapse-federation-reader", config)

View file

@ -198,7 +198,9 @@ def start(config_options):
) )
ss.setup() ss.setup()
reactor.callWhenRunning(_base.start, ss, config.worker_listeners) reactor.addSystemEventTrigger(
"before", "startup", _base.start, ss, config.worker_listeners
)
_base.start_worker_reactor("synapse-federation-sender", config) _base.start_worker_reactor("synapse-federation-sender", config)

View file

@ -247,7 +247,9 @@ def start(config_options):
) )
ss.setup() ss.setup()
reactor.callWhenRunning(_base.start, ss, config.worker_listeners) reactor.addSystemEventTrigger(
"before", "startup", _base.start, ss, config.worker_listeners
)
_base.start_worker_reactor("synapse-frontend-proxy", config) _base.start_worker_reactor("synapse-frontend-proxy", config)

View file

@ -447,7 +447,7 @@ def setup(config_options):
reactor.stop() reactor.stop()
sys.exit(1) sys.exit(1)
reactor.callWhenRunning(start) reactor.addSystemEventTrigger("before", "startup", start)
return hs return hs

View file

@ -161,7 +161,9 @@ def start(config_options):
) )
ss.setup() ss.setup()
reactor.callWhenRunning(_base.start, ss, config.worker_listeners) reactor.addSystemEventTrigger(
"before", "startup", _base.start, ss, config.worker_listeners
)
_base.start_worker_reactor("synapse-media-repository", config) _base.start_worker_reactor("synapse-media-repository", config)

View file

@ -216,7 +216,7 @@ def start(config_options):
_base.start(ps, config.worker_listeners) _base.start(ps, config.worker_listeners)
ps.get_pusherpool().start() ps.get_pusherpool().start()
reactor.callWhenRunning(start) reactor.addSystemEventTrigger("before", "startup", start)
_base.start_worker_reactor("synapse-pusher", config) _base.start_worker_reactor("synapse-pusher", config)

View file

@ -451,7 +451,9 @@ def start(config_options):
) )
ss.setup() ss.setup()
reactor.callWhenRunning(_base.start, ss, config.worker_listeners) reactor.addSystemEventTrigger(
"before", "startup", _base.start, ss, config.worker_listeners
)
_base.start_worker_reactor("synapse-synchrotron", config) _base.start_worker_reactor("synapse-synchrotron", config)

View file

@ -224,7 +224,9 @@ def start(config_options):
) )
ss.setup() ss.setup()
reactor.callWhenRunning(_base.start, ss, config.worker_listeners) reactor.addSystemEventTrigger(
"before", "startup", _base.start, ss, config.worker_listeners
)
_base.start_worker_reactor("synapse-user-dir", config) _base.start_worker_reactor("synapse-user-dir", config)