mirror of
https://github.com/flibusta-apps/meilie_updater.git
synced 2025-12-06 07:05:37 +01:00
Add sentry
This commit is contained in:
@@ -35,7 +35,7 @@ DEFAULT_RANKING_RULES = [
|
||||
]
|
||||
|
||||
|
||||
async def update_books(ctx) -> bool:
|
||||
async def update_books(ctx) -> bool: # NOSONAR
|
||||
loop = asyncio.get_event_loop()
|
||||
|
||||
meili = get_meilisearch_client()
|
||||
@@ -61,7 +61,7 @@ async def update_books(ctx) -> bool:
|
||||
return True
|
||||
|
||||
|
||||
async def update_authors(ctx) -> bool:
|
||||
async def update_authors(ctx) -> bool: # NOSONAR
|
||||
loop = asyncio.get_event_loop()
|
||||
|
||||
meili = get_meilisearch_client()
|
||||
@@ -98,14 +98,14 @@ async def update_authors(ctx) -> bool:
|
||||
|
||||
index.update_searchable_attributes(["first_name", "last_name", "middle_name"])
|
||||
index.update_filterable_attributes(["author_langs", "translator_langs"])
|
||||
index.update_ranking_rules([*DEFAULT_RANKING_RULES, "books_count:desc"])
|
||||
index.update_ranking_rules([*DEFAULT_RANKING_RULES, "books_count:desc"]) # NOSONAR
|
||||
|
||||
await postgres.close()
|
||||
|
||||
return True
|
||||
|
||||
|
||||
async def update_sequences(ctx) -> bool:
|
||||
async def update_sequences(ctx) -> bool: # NOSONAR
|
||||
loop = asyncio.get_event_loop()
|
||||
|
||||
meili = get_meilisearch_client()
|
||||
@@ -143,7 +143,7 @@ async def update_sequences(ctx) -> bool:
|
||||
return True
|
||||
|
||||
|
||||
async def update_genres(ctx) -> bool:
|
||||
async def update_genres(ctx) -> bool: # NOSONAR
|
||||
loop = asyncio.get_event_loop()
|
||||
|
||||
meili = get_meilisearch_client()
|
||||
@@ -183,7 +183,7 @@ async def update_genres(ctx) -> bool:
|
||||
return True
|
||||
|
||||
|
||||
async def update(ctx: dict, *args, **kwargs) -> bool:
|
||||
async def update(ctx: dict, *args, **kwargs) -> bool: # NOSONAR
|
||||
arq_pool: ArqRedis = ctx["arc_pool"]
|
||||
|
||||
await arq_pool.enqueue_job("update_books")
|
||||
|
||||
@@ -2,6 +2,7 @@ from fastapi import FastAPI
|
||||
|
||||
from app.views import router
|
||||
from core.arq_pool import get_arq_pool
|
||||
import core.sentry # noqa: F401
|
||||
|
||||
|
||||
def start_app() -> FastAPI:
|
||||
|
||||
@@ -17,5 +17,7 @@ class EnvConfig(BaseSettings):
|
||||
MEILI_HOST: str
|
||||
MEILI_MASTER_KEY: str
|
||||
|
||||
SENTRY_SDN: str
|
||||
|
||||
|
||||
env_config = EnvConfig()
|
||||
|
||||
8
src/core/sentry.py
Normal file
8
src/core/sentry.py
Normal file
@@ -0,0 +1,8 @@
|
||||
import sentry_sdk
|
||||
|
||||
from core.config import env_config
|
||||
|
||||
|
||||
sentry_sdk.init(
|
||||
env_config.SENTRY_SDN,
|
||||
)
|
||||
@@ -8,6 +8,7 @@ from app.services import (
|
||||
update_genres,
|
||||
)
|
||||
from core.arq_pool import get_redis_settings, get_arq_pool
|
||||
import core.sentry # noqa: F401
|
||||
|
||||
|
||||
async def startup(ctx):
|
||||
|
||||
Reference in New Issue
Block a user