resque / resque/resque-scheduler
Jobs from Rails 4, which are wrapped with the ActiveJob wrapper class do not show up in the timestamps results from the scheduled_at() function
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 1.7k
- Forks
- 477
- PR merge metrics
- No merged PRs in 30d
Description
Test case for this:
class ActiveJobTest < ActiveJob::Base
queue_as :test_queue
def self.queue
queue_name
end
def perform; end
end
timestamp = 5.minutes.from_now
ActiveJobTest.set(wait_until: timestamp).perform_later
klass = ActiveJob::QueueAdapters::ResqueAdapter::JobWrapper
jobs = Resque.delayed_timestamp_peek(timestamp, 0 ,1)
# something like [{"job_class":"SummaryEmailsJob","job_id":"c4407182-f824-4105-814b-7535247e5f91","queue_name":"summary_emails","arguments":[]}]
args = jobs.first['args']
@timestamps = Resque.scheduled_at(klass, *args)
This fails to return the job timestamp, because line 220 of delayed_extension.rb does this: search = encode(job_to_hash(klass, args)), which then calls queue_from_class(klass) later on. Because the ActiveJob wrapper does not know the queue name of the wrapped job class, queue_from_class returns false, which then causes the search to fail as the queue names don't match.
Not sure if the solution is to make a special case for ActiveJob or not. Feels hacky.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at delayed_extension.rb line 220 and trace scheduled_at through job_to_hash and queue_from_class for ActiveJob::QueueAdapters::ResqueAdapter::JobWrapper. Reproduce the ActiveJob example in the issue and inspect how the wrapped queue name is handled. Done means scheduled_at returns the timestamp for the wrapped job without breaking regular Resque job lookups.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rails, ruby
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100