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

rufus scheduler "overlap" option not working #504

Closed
dnajd opened this issue Jan 14, 2016 · 7 comments
Closed

rufus scheduler "overlap" option not working #504

dnajd opened this issue Jan 14, 2016 · 7 comments

Comments

@dnajd
Copy link

dnajd commented Jan 14, 2016

I noticed this setting in rufus scheduler. Is it possible to use with resque scheduler?
https://github.com/jmettraux/rufus-scheduler#overlap--false

I tried this

  name = "Blah"
  config = {}
  config[:class] = 'TheJob'
  config[:args] = 'arg'
  config[:every] = ['1m', {first_in: 1.minutes}]
  config[:persist] = true
  config[:queue] = 'queue'
  config[:overlap] = false
  Resque.set_schedule(name, config)

But it did't work...

@meatballhat meatballhat changed the title overlap false Add support for rufus scheduler "overlap false" Feb 10, 2016
@meatballhat
Copy link
Member

@dnajd afaict there's nothing in the resque-scheduler code to prevent this from working. Can you verify that the version of rufus-scheduler in your environment includes support for overlap?

@meatballhat meatballhat changed the title Add support for rufus scheduler "overlap false" rufus scheduler "overlap" option not working Jun 26, 2016
@peret
Copy link

peret commented Feb 27, 2017

Hi, I'm running into the same problem. I'm using resque-scheduler 4.3.0 and rufus-scheduler 3.3.0. So yes, the rufus-scheduler gem should support the overlap option.
I tested this by creating a resque job which sleeps for 10 seconds and then scheduling it every second, with the overlap option. Like this:

namespace :resque do
  task setup: [:environment] do
    Resque.schedule = {
      sleepy_worker: {
        class: 'SleepyWorker',
        queue: 'sleepy_worker',
        every: '1s',
        overlap: false
      }
   }
  end
end

I would expect that no new jobs get scheduled, as long as a job is still running on the same queue. They are, however, and the job queue fills up pretty quickly.

@peret
Copy link

peret commented Feb 27, 2017

I'm not familiar with the code at all, but is it maybe the case that the job that is scheduled with rufus is just a piece of code that enqueues a new job into the resque queue?

In that case, the overlap option would make sure that no two of these jobs run at the same time, which is not very useful because enqueuing a new resque job doesn't take that long anyway. But of course rufus has no concept of the state of the resque queue and of the actual work being done there, so it just keeps adding jobs.

I guess the question, in that case, is what the intended behavior really is. Is this a bug that needs to be fixed in resque-scheduler, or is this just a mismatch between the behavior I expected and the intended behavior? I think, at the very least, this behavior should be documented in the README.

@peret
Copy link

peret commented Feb 27, 2017

I whipped something up for my use case real quick and created a PR in case you decide to support this behavior.

@carsonreinke
Copy link
Contributor

Wouldn't using a combination of Resque plugins be a better solution? I feel like there is so many cases that could happen external to resque-scheduler.

@peret
Copy link

peret commented Mar 19, 2017

Maybe you are right. In that case it might be a good idea to update the README though: "All rufus-scheduler options are supported when setting schedules." Maybe it should be clarified, that the overlap option doesn't have the expected effect?

@carsonreinke
Copy link
Contributor

Noted here #612

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