Skip to content

Commit 3f026cb

Browse files
authored
Merge pull request #2602 from JamieeBond/feat/add-seven-zip-timeout-env-variable
Feat: Add SEVEN_ZIP_TIMEOUT
2 parents 01422a4 + b55ad52 commit 3f026cb

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

backend/config/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ def str_to_bool(value: str) -> bool:
2828
ASSETS_BASE_PATH: Final = f"{ROMM_BASE_PATH}/assets"
2929
FRONTEND_RESOURCES_PATH: Final = "/assets/romm/resources"
3030

31+
# SEVEN ZIP
32+
SEVEN_ZIP_TIMEOUT: Final = int(os.environ.get("SEVEN_ZIP_TIMEOUT", 60))
33+
3134
# DATABASE
3235
DB_HOST: Final[str | None] = os.environ.get("DB_HOST", "127.0.0.1") or None
3336
DB_PORT: Final[int | None] = (

backend/utils/archive_7zip.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from collections.abc import Callable
66
from pathlib import Path
77

8-
from config import ROMM_TMP_PATH
8+
from config import ROMM_TMP_PATH, SEVEN_ZIP_TIMEOUT
99
from logger.logger import log
1010

1111
SEVEN_ZIP_PATH = "/usr/bin/7zz"
@@ -30,7 +30,7 @@ def process_file_7z(
3030
capture_output=True,
3131
text=True,
3232
check=True,
33-
timeout=60,
33+
timeout=SEVEN_ZIP_TIMEOUT,
3434
shell=False, # trunk-ignore(bandit/B603): 7z path is hardcoded, args are validated
3535
)
3636

@@ -76,7 +76,7 @@ def process_file_7z(
7676
],
7777
capture_output=True,
7878
check=True,
79-
timeout=60,
79+
timeout=SEVEN_ZIP_TIMEOUT,
8080
shell=False, # trunk-ignore(bandit/B603): 7z path is hardcoded, args are validated
8181
)
8282

env.template

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ RESCAN_ON_FILESYSTEM_CHANGE_DELAY=5
8080
# Tasks (optional)
8181
TASK_TIMEOUT=300
8282
TASK_RESULT_TTL=86400
83+
SEVEN_ZIP_TIMEOUT=60
8384
ENABLE_SCHEDULED_RESCAN=true
8485
SCHEDULED_RESCAN_CRON=0 3 * * *
8586
ENABLE_SCHEDULED_UPDATE_SWITCH_TITLEDB=true

0 commit comments

Comments
 (0)