Created
June 5, 2020 01:47
-
-
Save takwas/23208b3e7b30828b922137c0369c23d5 to your computer and use it in GitHub Desktop.
fastapi_teardown.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def register_cleanup_hook(app: fastapi.FastAPI): | |
@app.on_event('shutdown') | |
async def cleanup_seq_handler(): | |
print('Worker shutting down. Cleaning up ...') | |
logger.info('Worker shutting down. Cleaning up ...') | |
# do some cleanup ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment