Skip to content

Commit

Permalink
exempt 4 in the morning from exclusion because of cleanup task, also …
Browse files Browse the repository at this point in the history
…refactor all_as_schedule test
  • Loading branch information
alirafiei75 committed Jan 3, 2025
1 parent 7b6e3a3 commit 09eeff9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
1 change: 1 addition & 0 deletions django_celery_beat/schedulers.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,7 @@ def get_excluded_hours_for_crontab_tasks():
str(current_hour).zfill(2), str(current_hour),
str(next_hour).zfill(2), str(next_hour),
str(previous_hour).zfill(2), str(previous_hour),
str(4), "04", # celery's default cleanup task
}

# Filter out 'should be considered' hours
Expand Down
13 changes: 7 additions & 6 deletions t/unit/test_schedulers.py
Original file line number Diff line number Diff line change
Expand Up @@ -455,12 +455,13 @@ def setup_scheduler(self, app):
solar('solar_noon', 48.06, 12.86))
self.m4.save()
self.m4.refresh_from_db()

dt_aware = make_aware(datetime(day=26,
month=7,
year=3000,
hour=1,
minute=0)) # future time
now = datetime.now()
two_minutes_later = now + timedelta(minutes=2)
dt_aware = make_aware(datetime(day=two_minutes_later.day,
month=two_minutes_later.month,
year=two_minutes_later.year,
hour=two_minutes_later.hour,
minute=two_minutes_later.minute)) # future time
self.m6 = self.create_model_clocked(
clocked(dt_aware)
)
Expand Down

0 comments on commit 09eeff9

Please # to comment.