mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-11-26 08:15:07 -05:00
Name migrate span of scanner
This commit is contained in:
parent
188ce3f67d
commit
37ec32b52d
@ -5,8 +5,10 @@ from logging import getLogger
|
|||||||
from typing import Any, cast
|
from typing import Any, cast
|
||||||
|
|
||||||
from asyncpg import Connection, Pool, create_pool
|
from asyncpg import Connection, Pool, create_pool
|
||||||
|
from opentelemetry import trace
|
||||||
|
|
||||||
logger = getLogger(__name__)
|
logger = getLogger(__name__)
|
||||||
|
tracer = trace.get_tracer("kyoo.scanner")
|
||||||
|
|
||||||
pool: Pool
|
pool: Pool
|
||||||
|
|
||||||
@ -55,6 +57,7 @@ async def get_db_fapi():
|
|||||||
yield db
|
yield db
|
||||||
|
|
||||||
|
|
||||||
|
@tracer.start_as_current_span("migrate")
|
||||||
async def migrate(migrations_dir="./migrations"):
|
async def migrate(migrations_dir="./migrations"):
|
||||||
async with get_db() as db:
|
async with get_db() as db:
|
||||||
_ = await db.execute(
|
_ = await db.execute(
|
||||||
|
|||||||
@ -75,7 +75,7 @@ class RequestProcessor:
|
|||||||
self._database.add_termination_listener(terminated)
|
self._database.add_termination_listener(terminated)
|
||||||
await self._database.add_listener("scanner_requests", process)
|
await self._database.add_listener("scanner_requests", process)
|
||||||
|
|
||||||
logger.info("Listening for requestes")
|
logger.info("Listening for requests")
|
||||||
_ = await closed.wait()
|
_ = await closed.wait()
|
||||||
logger.info("stopping...")
|
logger.info("stopping...")
|
||||||
except CancelledError:
|
except CancelledError:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user