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

Resque#scheduled_at returning empty array #479

Open
dlachasse opened this issue Jun 5, 2015 · 5 comments
Open

Resque#scheduled_at returning empty array #479

dlachasse opened this issue Jun 5, 2015 · 5 comments

Comments

@dlachasse
Copy link

I'm currently running Rails 4.2.0 and have a number of jobs tied to a specific class. When I call Resque.scheduled_at(class_name). I'm getting an empty array returned. I know the jobs exist because when I'm calling just Resque.schedule I get the hash listing all of my jobs out. I'd provide a stack trace but I'm not getting any errors! Is this broken for anyone else on Rails 4.2.0?

@yaauie
Copy link
Member

yaauie commented Jun 5, 2015

The trouble here is that in order to search, we need the whole payload of the job, not just its class.

https://github.com/resque/resque-scheduler/blob/v4.0.0/lib/resque/scheduler/delaying_extensions.rb#L218-L224

@dlachasse
Copy link
Author

Thanks for the quick response @yaauie. So I've tried passing in the *args as well and I'm still getting the same response. Here's an example of the setup.

resque_schedule.yml

some_scheduled_job:
  cron: "0 2 * * *"
  class: "SomeJob"
  args: "SomeArg"
  description: "Do Something"


Resque.scheduled_at(SomeJob, ["SomeArg"]) => []

@yaauie
Copy link
Member

yaauie commented Jun 5, 2015

The trouble is that the args have to be exact.

In this case, I believe it is different because Resque::scheduled_at takes a variable number of args, so the * (splat) may be causing some confusion, causing args to be [["SomeArg"]] (notice the extra layer of array).

I think you would mean:

Resque.scheduled_at(SomeJob, "SomeArg")

@cgpsn
Copy link

cgpsn commented Jun 5, 2015

@yaauie We've tried about every combination of args and even jobs not requiring any args at all and it fails to return anything. Any tips?

@greggroth
Copy link

Based on the source for Rescue.scheduled_at I checked redis for keys starting with timestamps: and came up short:

irb(main):003:0> REDIS.keys('timestamps:*')
=> []

Does this method eagerly store a job in redis for jobs in the schedule or does this only return jobs explicitly scheduled with Resque.enqueue_at?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants