diff --git a/DEVELOPER-SETUP.md b/DEVELOPER-SETUP.md index 95ed4e0a8..63998a543 100644 --- a/DEVELOPER-SETUP.md +++ b/DEVELOPER-SETUP.md @@ -51,6 +51,14 @@ cd backend python main.py ``` + +### - Start a worker + +```sh +cd backend +python worker.py +``` + ## Setting up the frontend ### - Install node.js dependencies diff --git a/backend/endpoints/scan.py b/backend/endpoints/scan.py index f8450c9f6..53abd8e38 100644 --- a/backend/endpoints/scan.py +++ b/backend/endpoints/scan.py @@ -6,7 +6,6 @@ from logger.logger import log from utils import fs, fastapi from utils.exceptions import PlatformsNotFoundException, RomsNotFoundException from handler import dbh -from models.rom import Rom from handler.socket_manager import socket_server from worker import redis_conn, redis_url @@ -33,7 +32,7 @@ async def scan_platforms(paltforms: str, complete_rescan: bool): scanned_platform = fastapi.scan_platform(p_slug) except RomsNotFoundException as e: log.error(e) - return + continue await sm.emit( "scan:scanning_platform", @@ -49,7 +48,7 @@ async def scan_platforms(paltforms: str, complete_rescan: bool): if rom_id and not complete_rescan: continue - scanned_rom: Rom = fastapi.scan_rom(scanned_platform, rom) + scanned_rom = fastapi.scan_rom(scanned_platform, rom) await sm.emit( "scan:scanning_rom", { diff --git a/backend/handler/igdb_handler.py b/backend/handler/igdb_handler.py index a27f4a917..fa6460050 100644 --- a/backend/handler/igdb_handler.py +++ b/backend/handler/igdb_handler.py @@ -235,12 +235,13 @@ class TwitchAuth: sys.exit(2) # Set token in redis to expire in seconds - redis_client.set("twitch_token", token, ex=expires_in) + redis_client.set("twitch_token", token, ex=expires_in - 10) log.info("Twitch token fetched!") return token def get_oauth_token(self) -> str: + # Use a fake token when running tests if "pytest" in sys.modules: return "test_token"