diff --git a/backend/services/ytdlp.py b/backend/services/ytdlp.py index 1bd5432..259eec3 100644 --- a/backend/services/ytdlp.py +++ b/backend/services/ytdlp.py @@ -33,8 +33,10 @@ def _meta_run(args: list[str], timeout: int = 60) -> tuple[str, str, int]: wait = _META_MIN_GAP - (now - _meta_last_call) if wait > 0: time.sleep(wait + random.uniform(0.5, 2.5)) - _meta_last_call = time.monotonic() - return _run(args, timeout=timeout) + try: + return _run(args, timeout=timeout) + finally: + _meta_last_call = time.monotonic() def _parse_date(date_str: str | None) -> datetime | None: