add code for level 4
This commit is contained in:
@@ -13,6 +13,7 @@ from .errors import ApiError
|
||||
from .models import ErrorDetails, ErrorResponse
|
||||
from .config import load_settings
|
||||
from .routes import router
|
||||
from .storage.history_cache import HistoryCache
|
||||
from .storage.postgres import PostgresStore
|
||||
|
||||
|
||||
@@ -35,9 +36,13 @@ async def lifespan(application: FastAPI):
|
||||
await store.migrate()
|
||||
application.state.store = store
|
||||
application.state.settings = settings
|
||||
cache = HistoryCache(settings.cache_url, settings.cache_ttl_seconds)
|
||||
await cache.connect()
|
||||
application.state.history_cache = cache
|
||||
try:
|
||||
yield
|
||||
finally:
|
||||
await cache.close()
|
||||
await store.close()
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user