diff --git a/contributors/emails/salch-cred@users.noreply.github.com b/contributors/emails/salch-cred@users.noreply.github.com new file mode 100644 index 0000000000..c6c66711a0 --- /dev/null +++ b/contributors/emails/salch-cred@users.noreply.github.com @@ -0,0 +1 @@ +salch-cred diff --git a/cron/jobs.py b/cron/jobs.py index eb7a3a42e4..9c012001b9 100644 --- a/cron/jobs.py +++ b/cron/jobs.py @@ -782,13 +782,14 @@ def parse_duration(s: str) -> int: "30m" → 30 "2h" → 120 "1d" → 1440 + "hour" → 60 (bare unit, no leading number) """ s = s.strip().lower() - match = re.match(r'^(\d+)\s*(m|min|mins|minute|minutes|h|hr|hrs|hour|hours|d|day|days)$', s) + match = re.match(r'^(\d*)\s*(m|min|mins|minute|minutes|h|hr|hrs|hour|hours|d|day|days)$', s) if not match: raise ValueError(f"Invalid duration: '{s}'. Use format like '30m', '2h', or '1d'") - value = int(match.group(1)) + value = int(match.group(1)) if match.group(1) else 1 unit = match.group(2)[0] # First char: m, h, or d multipliers = {'m': 1, 'h': 60, 'd': 1440}