Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion netbox/netbox/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

from django.core.exceptions import ImproperlyConfigured
from django.utils.functional import classproperty
from django.utils import timezone
from django_pglocks import advisory_lock
from rq.timeouts import JobTimeoutException

Expand Down Expand Up @@ -113,7 +114,11 @@ def handle(cls, job, *args, **kwargs):
# If the executed job is a periodic job, schedule its next execution at the specified interval.
finally:
if job.interval:
new_scheduled_time = (job.scheduled or job.started) + timedelta(minutes=job.interval)
# Determine the new scheduled time. Cannot be earlier than one minute in the future.
new_scheduled_time = max(
(job.scheduled or job.started) + timedelta(minutes=job.interval),
timezone.now() + timedelta(minutes=1)
)
if job.object and getattr(job.object, "python_class", None):
kwargs["job_timeout"] = job.object.python_class.job_timeout
cls.enqueue(
Expand Down