Startup / Shutdown events
See original GitHub issueRefs https://github.com/django/asgiref/pull/63
Add @app.startup
and @app.shutdown
decorators that call into code on lifespan startup/shutdown.
Eg…
app = Starlette()
@app.startup
async def initialize_database_connection_pool():
...
@app.shutdown
async def close_database_connection():
...
You’ll be able to add multiple startup/shutdown events.
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
How to Check Your Startup and Shutdown History in Windows
1. Use the Event Viewer · Event ID 41 - this event is logged when you reboot your PC without shutting it down...
Read more >Where and how to see the Shutdown and Startup log in ...
1) View Shutdown and Restart Log from Event Viewer · Press the Windows logo + R keys to invoke the Run dialog ·...
Read more >How to See PC Startup and Shutdown History in Windows 10
Using Event Logs to Extract Startup and Shutdown Times · 1. Open Event Viewer (press Win + R and type eventvwr ). ·...
Read more >Windows event codes for startup/shutdown lock/unlock
Refering to your request about starting and shutdown event IDs, I made the list below based on a Windows 10 machine.
Read more >Events: startup - shutdown - FastAPI
Events : startup - shutdown¶. You can define event handlers (functions) that need to be executed before the application starts up, or when...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
awesome thanks!
@freakypie See also https://github.com/encode/starlette/issues/58#issuecomment-424257205