Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calling reload_schedule! resets pending waiting every jobs #248

Open
soundasleep opened this issue Mar 28, 2018 · 4 comments
Open

Calling reload_schedule! resets pending waiting every jobs #248

soundasleep opened this issue Mar 28, 2018 · 4 comments
Assignees

Comments

@soundasleep
Copy link
Contributor

It seems that whenever you call Sidekiq::Scheduler.reload_schedule!, it resets all jobs scheduled for every.

This means that if you call Sidekiq::Scheduler.reload_schedule! once per hour, but you have a job that's scheduled to run every two hours (or longer), the job will never be started.

@snmgian
Copy link
Contributor

snmgian commented Apr 30, 2018

Hi,

Are you modifying the schedule by calling Sidekiq.set_schedule ?

In that case calling Sidekiq::Scheduler.update_schedule instead, will work. (I'll modify the README in case you confirm)

Are you calling reload!_schedule from a sidekiq job?

@soundasleep
Copy link
Contributor Author

I'm modifying the schedule from a sidekiq job, yes:

  def call
    Sidekiq.schedule = generated_schedule
    Sidekiq::Scheduler.reload_schedule!
    del('*', 100, false)
  end

I'm wondering if the del is getting in the way, I'll try remove that and see if that resolves the issue.

@snmgian
Copy link
Contributor

snmgian commented Apr 30, 2018

I don't see del call as a problem here.

The call to reload_schedule is instantiating a new rufus scheduler, so every and interval jobs are reset.

A different method is needed to update the schedule when using Sidekiq.schedule=. I'll keep you posted.

@choubacha
Copy link

choubacha commented Aug 5, 2019

@snmgian I just ran into this issue when trying to work with the API. I think that updating the documentation would help a lot. I was able to correct it by using Sidekiq::Scheduler.instance.update_schedule after calling set_schedule when it was non-dynamic. The current documentation makes it seem like one should call reload_schedule! which ends up causing multiple firings of the same schedule.

@marcelolx marcelolx self-assigned this May 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants