mirror of
https://github.com/rommapp/romm.git
synced 2026-02-18 00:27:41 +01:00
redis enabled as experimental
This commit is contained in:
@@ -37,6 +37,7 @@ DB_PASSWD: Final = os.environ.get("DB_PASSWD")
|
||||
DB_NAME: Final = os.environ.get("DB_NAME", "romm")
|
||||
|
||||
# REDIS
|
||||
ENABLE_EXPERIMENTAL_REDIS: Final = os.environ.get("ENABLE_EXPERIMENTAL_REDIS", "false") == "true"
|
||||
REDIS_HOST: Final = os.environ.get("REDIS_HOST", "localhost")
|
||||
REDIS_PORT: Final = os.environ.get("REDIS_PORT", "6379")
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ import socketio # type: ignore
|
||||
from rq import Queue
|
||||
|
||||
from logger.logger import log
|
||||
from config import ENABLE_EXPERIMENTAL_REDIS
|
||||
from utils import fs, fastapi
|
||||
from exceptions.fs_exceptions import PlatformsNotFoundException, RomsNotFoundException
|
||||
from handler import dbh
|
||||
@@ -88,7 +89,7 @@ async def scan_handler(_sid: str, options: dict):
|
||||
selected_roms = options.get("roms", [])
|
||||
|
||||
# Run in worker if redis is available
|
||||
if redis_connectable:
|
||||
if redis_connectable and ENABLE_EXPERIMENTAL_REDIS:
|
||||
return scan_queue.enqueue(
|
||||
scan_platforms, platform_slugs, complete_rescan, selected_roms
|
||||
)
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
import sys
|
||||
from rq import Worker, Queue, Connection
|
||||
|
||||
from config import ENABLE_EXPERIMENTAL_REDIS
|
||||
from utils.cache import redis_client, redis_connectable
|
||||
|
||||
listen = ["high", "default", "low"]
|
||||
|
||||
if __name__ == "__main__":
|
||||
# Exit if Redis is not connectable
|
||||
if not redis_connectable:
|
||||
if not redis_connectable or not ENABLE_EXPERIMENTAL_REDIS:
|
||||
sys.exit(0)
|
||||
|
||||
with Connection(redis_client):
|
||||
|
||||
@@ -12,9 +12,9 @@ services:
|
||||
ports:
|
||||
- $DB_PORT:3306
|
||||
|
||||
# redis:
|
||||
# image: redis:alpine
|
||||
# container_name: redis
|
||||
# restart: unless-stopped
|
||||
# ports:
|
||||
# - ${REDIS_PORT}:6379
|
||||
redis:
|
||||
image: redis:alpine
|
||||
container_name: redis
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- ${REDIS_PORT}:6379
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
VERSION=$(cat .romm-version)
|
||||
VERSION="2.0.0"
|
||||
branch_name="$(git symbolic-ref HEAD 2>/dev/null)"
|
||||
branch_name=${branch_name##refs/heads/}
|
||||
docker build -t zurdi15/romm:local-${VERSION}-${branch_name} . --file ./docker/Dockerfile
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
|
||||
cd /back
|
||||
nc -z ${REDIS_HOST:-localhost} ${REDIS_PORT:-6379} && rq worker high default low --logging_level WARN
|
||||
[[ -z ${ENABLE_EXPERIMENTAL_REDIS} ]] && rq worker high default low --logging_level WARN
|
||||
|
||||
Reference in New Issue
Block a user