Changes from self review

This commit is contained in:
Georges-Antoine Assi
2023-08-04 23:52:02 -04:00
parent dc898358bb
commit 2317befca1
3 changed files with 12 additions and 4 deletions

View File

@@ -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

View File

@@ -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",
{

View File

@@ -235,12 +235,13 @@ class TwitchAuth:
sys.exit(2)
# Set token in redis to expire in <expires_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"