Fix scanner's teardown

This commit is contained in:
Zoe Roux 2025-05-13 23:22:36 +02:00
parent 0ef3348e9c
commit e8deee8e33
No known key found for this signature in database

View File

@ -25,10 +25,12 @@ async def lifespan(_):
get_db() as db, get_db() as db,
KyooClient() as client, KyooClient() as client,
TheMovieDatabase() as tmdb, TheMovieDatabase() as tmdb,
RequestProcessor(db, client, CompositeProvider(tmdb)) as processor,
): ):
# creating the processor makes it listen to requests event in pg # creating the processor makes it listen to requests event in pg
async with get_db() as db: async with (
RequestProcessor(db, client, CompositeProvider(tmdb)) as processor,
get_db() as db,
):
scanner = FsScanner(client, RequestCreator(db)) scanner = FsScanner(client, RequestCreator(db))
# there's no way someone else used the same id, right? # there's no way someone else used the same id, right?
is_master = await db.fetchval("select pg_try_advisory_lock(198347)") is_master = await db.fetchval("select pg_try_advisory_lock(198347)")