You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Someone (invk7244) posted the following example in our Discord to replicate this:
importasynciofromsanicimportSanicfromsanic.responseimporttextSanic.START_METHOD_SET=TrueSanic.start_method="fork"asyncdefindex(request):
returntext("dummy")
asyncdefwait_some_time(app, loop):
"""Operations to perform on server shutdown. For demo just a sleep"""awaitasyncio.sleep(5)
defmake_app() ->Sanic:
app=Sanic(name="dummy")
app.add_route(index, "/")
app.register_listener(wait_some_time, "before_server_stop")
returnappdefrun_server():
app=make_app()
app.run(host="0.0.0.0", port=8000)
if__name__=="__main__":
run_server()
Is there an existing issue for this?
Describe the bug
Python 3.12.3
sanic-23.12.1
very often (not 100%) after restarting worker, for example:
@apt.get("/restart")
I get this output after Ctrl-C:
is this a mistake or am I doing something wrong?
Code snippet
Expected Behavior
No response
How do you run Sanic?
As a script (
app.run
orSanic.serve
)Operating System
Linux
Sanic Version
23.12.1
Additional context
No response
The text was updated successfully, but these errors were encountered: