This commit adds an async context manager method lifetime_function to the ServiceSettingsBase class, enabling the execution of specific code at startup and shutdown. The lifetime_function is also appended to app.lifetime_functions in the routers/__init__.py file to be tracked and executed by the application, in similar way to how the databases track state for the lifetime of the application.
Needs #118. Only the last commit is relavent.
This commit adds an
async
context manager methodlifetime_function
to theServiceSettingsBase
class, enabling the execution of specific code at startup and shutdown. Thelifetime_function
is also appended toapp.lifetime_functions
in therouters/__init__.py
file to be tracked and executed by the application, in similar way to how the databases track state for the lifetime of the application.