rq / rq-scheduler

A lightweight library that adds job scheduling capabilities to RQ (Redis Queue)
MIT License
1.45k stars 230 forks source link

Cron runs twice if specify exact minute #250

Open TsimafeiTsykunou opened 4 years ago

TsimafeiTsykunou commented 4 years ago

Found weird behaviour, when you specify cronstring like 0 3 * * * job will be executed 2 times: 1) at 3:00 2) at 3:01

TsimafeiTsykunou commented 4 years ago

@Eugeny could you help with it, please?

Eugeny commented 4 years ago

No, sorry, I'm not one of the core developers.

TsimafeiTsykunou commented 4 years ago

Guys?? Does anyone supporting this package??

TsimafeiTsykunou commented 4 years ago

@Eugeny Hi again. I actually found out that the issue is in get_next_sheduled_time method: it calculates cron next scheduled time relative to current time and so if job was enqued 2020-01-01 3:00:00AM it will be scheduled again to 2020-01-01 3:00AM because cron_string not using seconds but now var using it.

Eugeny commented 4 years ago

now isn't "using" seconds, it's a datetime object.

TsimafeiTsykunou commented 4 years ago

@Eugeny datetime.utcnow() returns whole time with seconds.

TsimafeiTsykunou commented 4 years ago

Hello? Could anyone assist with this issue?? Almost 3 weeks have passed since the opening...

selwin commented 4 years ago

@TsimafeiTsykunou please open a PR for this :)