Skip to content

Commit

Permalink
The other fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Matvey-Kuk committed Sep 11, 2024
1 parent 71a97ed commit 8d03584
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 1 addition & 3 deletions arq/connections.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,7 @@ async def enqueue_job(
else:
score = enqueue_time_ms

expires_ms = expires_ms or (
1 if score - enqueue_time_ms < 1 else score - enqueue_time_ms + self.expires_extra_ms
)
expires_ms = expires_ms or score - enqueue_time_ms + self.expires_extra_ms

job = serialize_job(function, args, kwargs, _job_try, enqueue_time_ms, serializer=self.job_serializer)
pipe.multi()
Expand Down
3 changes: 2 additions & 1 deletion arq/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -751,7 +751,8 @@ async def run_cron(self, n: datetime, delay: float, num_windows: int = 2) -> Non
job_id = f'{cron_job.name}:{to_unix_ms(cron_job.next_run)}' if cron_job.unique else None
job_futures.add(
self.pool.enqueue_job(
cron_job.name, _job_id=job_id, _queue_name=self.queue_name, _defer_until=cron_job.next_run
cron_job.name, _job_id=job_id, _queue_name=self.queue_name,
_defer_until=(cron_job.next_run if cron_job.next_run > datetime.now(tz=self.timezone) else None),
)
)
cron_job.calculate_next(cron_job.next_run)
Expand Down

0 comments on commit 8d03584

Please sign in to comment.