I’m upgrading an app to Sanic V22.12.0 and the following listeners aren’t been attached anymore.
before_server_start
after_server_start
after_server_stop
The methods attached to these listeners are no longer been called, but I get no error.
I’m using the AppLoader
object alongside a factory to create the app and serving with Sanic.serve
.
def serve_application(port, interface, ssl_context,) -> None:
app, loader = configure_app()
app.register_listener(
partial(load_agent_on_start, model_path, endpoints, remote_storage),
"before_server_start",
)
app.register_listener(
partial(load_agent_on_start, model_path, endpoints, remote_storage),
"before_server_start",
)
app.register_listener(close_resources, "after_server_stop")
app.prepare(
host=interface,
port=port,
ssl=ssl_context,
backlog=int(os.environ.get(ENV_SANIC_BACKLOG, "100")),
workers=1,
)
Sanic.serve(primary=app, app_loader=loader)
Any help is appreciated, thanks!