Skip to content

Commit

Permalink
flake8
Browse files Browse the repository at this point in the history
  • Loading branch information
alirafiei75 committed Jan 2, 2025
1 parent 98c8eee commit 7b6e3a3
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions django_celery_beat/schedulers.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,9 +254,13 @@ def all_as_schedule(self):
debug('DatabaseScheduler: Fetching database schedule')
s = {}
next_five_minutes = now() + datetime.timedelta(minutes=5)
exclude_clock_tasks_query = Q(clocked__isnull=False, clocked__clocked_time__gt=next_five_minutes)
exclude_clock_tasks_query = Q(
clocked__isnull=False, clocked__clocked_time__gt=next_five_minutes
)
exclude_hours = self.get_excluded_hours_for_crontab_tasks()
exclude_cron_tasks_query = Q(crontab__isnull=False, crontab__hour__in=exclude_hours)
exclude_cron_tasks_query = Q(
crontab__isnull=False, crontab__hour__in=exclude_hours
)
for model in self.Model.objects.enabled().exclude(
exclude_clock_tasks_query | exclude_cron_tasks_query
):
Expand Down Expand Up @@ -409,4 +413,7 @@ def get_excluded_hours_for_crontab_tasks():
}

# Filter out 'should be considered' hours
return [hour for hour in allowed_crontab_hours if hour not in hours_to_remove]
return [
hour for hour in allowed_crontab_hours
if hour not in hours_to_remove
]

0 comments on commit 7b6e3a3

Please sign in to comment.