When using sanic with workers in VS Code, even with debug=True, some workers appear to be left running after I stop it debugging. Is that expected behaviour? I’m on windows 10 with python 3.6 and VS Code 1.28.2.
It may be related to the discussions Following: `auto_reload` support for Windows about hooking into the debuggers in various IDEs.
from sanic import Sanic
from sanic.response import json
app = Sanic()
@app.route('/')
async def test(request):
return json({'hello': "world"})
if __name__ == '__main__':
app.run(host='0.0.0.0', port=8020, workers=10)
2018-10-28 16:05:52 -0000] - (sanic.access)[INFO][127.0.0.1:65343]: GET http://127.0.0.1:8020/ 200 24
Executing <Task finished coro=<Sanic.handle_request() done, defined at C:\Users\mark\AppData\Roaming\Python\Python36\site-packages\sanic\app.py:561> result=None created at C:\Users\mark\AppData\Roaming\Python\Python36\site-packages\sanic\server.py:295> took 5.000 seconds
I then stopped debugging so I get the command prompt, but requests are still handled and I have to restart VS Code to stop them:
C:\Users\mark\source\repos\sanic_threads>Executing <Handle BaseSelectorEventLoop._accept_connection(functools.par…e, debug=True), <socket.socke…0.0.0’, 8020)>, None, <Server socke…0.0’, 8020)>]>, 100) created at C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\lib\asyncio\selector_events.py:262> took 14.125 seconds
Executing <Handle BaseSelectorEventLoop._accept_connection(functools.par…e, debug=True), <socket.socke…0.0.0’, 8020)>, None, <Server socke…0.0’, 8020)>]>, 100) created at C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\lib\asyncio\selector_events.py:262> took 14.125 seconds
[2018-10-28 16:06:06 -0000] - (sanic.access)[INFO][127.0.0.1:65346]: GET http://127.0.0.1:8020/ 200 24
Executing <Task finished coro=<Sanic.handle_request() done, defined at C:\Users\mark\AppData\Roaming\Python\Python36\site-packages\sanic\app.py:561> result=None created at C:\Users\mark\AppData\Roaming\Python\Python36\site-packages\sanic\server.py:295> took 5.000 seconds