DIRACGrid / diracx

The neXt DIRAC generation
GNU General Public License v3.0
8 stars 20 forks source link

Add lifetime_function to ServiceSettingsBase #119

Closed chrisburr closed 11 months ago

chrisburr commented 11 months ago

Needs #118. Only the last commit is relavent.

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.