mirror of
https://github.com/flibusta-apps/telegram_files_cache_server.git
synced 2026-03-03 15:10:48 +01:00
Add download_dump endpoint
This commit is contained in:
@@ -6,6 +6,7 @@ from prometheus_fastapi_instrumentator import Instrumentator
|
||||
from app.views import router, healthcheck_router
|
||||
from core.arq_pool import get_arq_pool
|
||||
from core.db import database
|
||||
from core.redis_client import get_client
|
||||
import core.sentry # noqa: F401
|
||||
|
||||
|
||||
@@ -24,6 +25,7 @@ def start_app() -> FastAPI:
|
||||
await database_.connect()
|
||||
|
||||
app.state.arq_pool = await get_arq_pool()
|
||||
app.state.redis_client = get_client()
|
||||
|
||||
@app.on_event("shutdown")
|
||||
async def shutdown() -> None:
|
||||
|
||||
9
src/core/redis_client.py
Normal file
9
src/core/redis_client.py
Normal file
@@ -0,0 +1,9 @@
|
||||
import aioredis
|
||||
|
||||
from core.config import env_config
|
||||
|
||||
|
||||
def get_client() -> aioredis.Redis:
|
||||
return aioredis.Redis(
|
||||
host=env_config.REDIS_HOST, port=env_config.REDIS_PORT, db=env_config.REDIS_DB
|
||||
)
|
||||
@@ -1,13 +1,11 @@
|
||||
import aioredis
|
||||
|
||||
from app.services.cache_updater import (
|
||||
check_books,
|
||||
cache_file_by_book_id,
|
||||
check_books_page,
|
||||
)
|
||||
from core.arq_pool import get_redis_settings, get_arq_pool
|
||||
from core.config import env_config
|
||||
from core.db import database
|
||||
from core.redis_client import get_client
|
||||
import core.sentry # noqa: F401
|
||||
|
||||
|
||||
@@ -16,9 +14,7 @@ async def startup(ctx):
|
||||
await database.connect()
|
||||
|
||||
ctx["arc_pool"] = await get_arq_pool()
|
||||
ctx["redis"] = aioredis.Redis(
|
||||
host=env_config.REDIS_HOST, port=env_config.REDIS_PORT, db=env_config.REDIS_DB
|
||||
)
|
||||
ctx["redis"] = get_client()
|
||||
|
||||
|
||||
async def shutdown(ctx):
|
||||
|
||||
Reference in New Issue
Block a user