Skip to content

Commit

Permalink
[Fix] Issue with scheduler not respecting proper ranges
Browse files Browse the repository at this point in the history
Should close #179
  • Loading branch information
Drazzilb08 committed Jul 3, 2024
1 parent 76735fd commit 4785377
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions util/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ def check_schedule(script_name, schedule, logger):
start, end = start_end.split("-")
start_month, start_day = map(int, start.split("/"))
end_month, end_day = map(int, end.split("/"))
current_month, current_day = map(int, now.strftime("%m/%d").split("/"))

if start_month <= current_month <= end_month and start_day <= current_day <= end_day:
start_date = datetime(now.year, start_month, start_day)
end_date = datetime(now.year, end_month, end_day)
if start_date <= now <= end_date:
return True
elif frequency == "cron":
local_tz = tz.tzlocal()
Expand All @@ -80,7 +80,6 @@ def check_schedule(script_name, schedule, logger):
next_run_times[script_name] = next_run

logger.debug(f"Next run for {script_name}: {next_run}\n")

return True
else:
logger.debug(f"Next run time for script {script_name}: {next_run} is in the future\n")
Expand Down

0 comments on commit 4785377

Please sign in to comment.