Skip to content

Commit

Permalink
fix: Initialize context on scheduled task
Browse files Browse the repository at this point in the history
Only for this scheduled task, the run was failing because there was no
context initialization that created the httpx session.

Other schedules work as expected, because they do have context
initialization in the functions they call to (e.g. `scan_platforms`).
  • Loading branch information
adamantike committed Jul 27, 2024
1 parent 9b52a4b commit fe5759f
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions backend/tasks/update_switch_titledb.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from handler.redis_handler import async_cache
from logger.logger import log
from tasks.tasks import RemoteFilePullTask
from utils.context import initialize_context
from utils.iterators import batched

SWITCH_TITLEDB_INDEX_KEY: Final = "romm:switch_titledb"
Expand All @@ -24,6 +25,7 @@ def __init__(self):
url="https://raw.githubusercontent.com/blawar/titledb/master/US.en.json",
)

@initialize_context()
async def run(self, force: bool = False) -> None:
content = await super().run(force)
if content is None:
Expand Down

0 comments on commit fe5759f

Please sign in to comment.