question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Startup / Shutdown events

See original GitHub issue

Refs 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:closed
  • Created 5 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
dfcarpentercommented, Oct 9, 2018

awesome thanks!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found