Replies: 2 comments 2 replies
-
|
This is an extremely awesome, flexible feature but... I've noticed when
Tremolo 0.2.9 on Python 3.12 import asyncio
from tremolo import Tremolo
app = Tremolo()
import sys
@app.route('/reload')
async def reload(**server):
sys.exit(3)
@app.on_worker_start
async def on_start(**_):
print("Starting.. I always print")
@app.on_worker_stop
async def on_stop(**_):
print("Stopping.. I never print when /reload happens")
if __name__ == '__main__':
app.run('0.0.0.0', 9999, worker_num=2, reload=True, debug=True)After visiting http://127.0.0.1:9999/reload |
Beta Was this translation helpful? Give feedback.
-
|
Thank you for testing this feature!
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
You can reload the worker from the web with
sys.exit(3), whereas shutdown withsys.exit(0).It also works if using Tremolo as ASGI server. You can do
sys.exit(3)from the handler in the app.In app frameworks that catch
BaseExceptionrather thanException, it won't work. But app frameworks shouldn't do that.It appears that this feature is exclusive to Tremolo, because the other ASGI servers I tried gave unexpected results.
Beta Was this translation helpful? Give feedback.
All reactions