use callback payloads for _SPAWN events

This patch switches callbacks over to the payload object style events
[1] for BEFORE_SPAWN and AFTER_SPAWN based notifications. As no event
data is passed for SPAWN notifications, an actual payload object is
not needed and thus this change uses publish() rather than notify()
and updates and callback receivers to accept the payload parameter.



Change-Id: Ifad4781d82aa07f213f4e075b0c9455aa95e94bb
This commit is contained in:
Boden R 2017-12-12 11:31:14 -07:00
parent 5641992591
commit 10644ad65b
2 changed files with 3 additions and 3 deletions

View File

@ -89,7 +89,7 @@ def serve_wsgi(cls):
LOG.exception('Unrecoverable error: please check log '
'for details.')
registry.notify(resources.PROCESS, events.BEFORE_SPAWN, service)
registry.publish(resources.PROCESS, events.BEFORE_SPAWN, service)
return service
@ -262,7 +262,7 @@ def _start_workers(workers):
def start_all_workers():
workers = _get_rpc_workers() + _get_plugins_workers()
launcher = _start_workers(workers)
registry.notify(resources.PROCESS, events.AFTER_SPAWN, None)
registry.publish(resources.PROCESS, events.AFTER_SPAWN, None)
return launcher

View File

@ -69,4 +69,4 @@ class TestRunWsgiApp(base.BaseTestCase):
registry.subscribe(callback, resources.PROCESS, events.AFTER_SPAWN)
resources.PROCESS, events.AFTER_SPAWN, mock.ANY)
resources.PROCESS, events.AFTER_SPAWN, mock.ANY, payload=None)