Skip to content

Commit

Permalink
Update get_next_run_time to handle Paused jobs
Browse files Browse the repository at this point in the history
Paused jobs have next_run_time of None.

This change makes django_apscheduler.jobstores looks a bit more like apscheduler.jobstores.sqlalchemy which filters out the nulls and picks the earliest next_run_time.
  • Loading branch information
nialllo authored Jun 1, 2018
1 parent 803dbf6 commit 88d9a5a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion django_apscheduler/jobstores.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def get_due_jobs(self, now):
@ignore_database_error()
def get_next_run_time(self):
try:
return deserialize_dt(DjangoJob.objects.first().next_run_time)
return deserialize_dt(DjangoJob.objects.filter(next_run_time__isnull=False).earliest('next_run_time').next_run_time)
except AttributeError: # no active jobs
return None

Expand Down

1 comment on commit 88d9a5a

@zhouwe1
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This changed commit caused the problem:
#25

Please sign in to comment.