Hi, I am developing a simple app with Sanic, I have been using older version, but moved to 22.12 recently. Running on my localhost, every time I stop the process with Keyboard interrupt, it raises an error:
Sanic.serve(primary=app, app_loader=loader)
File ".../lib/python3.8/site-packages/sanic/mixins/startup.py", line 880, in serve
sock.shutdown(SHUT_RDWR)
OSError: [Errno 57] Socket is not connected
It then doesn’t execute the rest of the ‘shutdown’ code and so other my stuff don’t get executed…
But while running, it responds and runs normally.
This is how I run the server:
if __name__ == "__main__":
loader = AppLoader(factory=partial(create_api_app))
app = loader.load()
app.prepare(port=port, debug=debug, access_log=debug)
Sanic.serve(primary=app, app_loader=loader)
and from CLI simply:
python main.py
My development machine is iMac with MacOS 13.2.1
Am I doing something wrong here?
Thanks