mirror of
https://github.com/gyptazy/ProxLB.git
synced 2026-04-05 20:31:57 +02:00
fix: allow use of minutes instead of hours
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
fixed:
|
||||
- allow the use of minutes instead of hours and only accept hours or minutes in the format [#187]
|
||||
@@ -124,11 +124,14 @@ class Helper:
|
||||
sys.exit(1)
|
||||
|
||||
# Convert hours to seconds
|
||||
if proxlb_config["service"]["schedule"].get("format", "hours"):
|
||||
if proxlb_config["service"]["schedule"].get("format", "hours") == "hours":
|
||||
sleep_seconds = proxlb_config.get("service", {}).get("schedule", {}).get("interval", 12) * 3600
|
||||
# Convert minutes to seconds
|
||||
else:
|
||||
elif proxlb_config["service"]["schedule"].get("format", "hours") == "minutes":
|
||||
sleep_seconds = proxlb_config.get("service", {}).get("schedule", {}).get("interval", 720) * 60
|
||||
else:
|
||||
logger.error("Invalid format for schedule. Please use 'hours' or 'minutes'.")
|
||||
sys.exit(1)
|
||||
|
||||
logger.info(f"Daemon mode active: Next run in: {proxlb_config.get('service', {}).get('schedule', {}).get('interval', 12)} {proxlb_config['service']['schedule'].get('format', 'hours')}.")
|
||||
time.sleep(sleep_seconds)
|
||||
|
||||
Reference in New Issue
Block a user