Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Can I stack resque gem with plugin resque-history and ActiveJob? #111

Open
smartkrio opened this issue Feb 13, 2015 · 1 comment
Open

Can I stack resque gem with plugin resque-history and ActiveJob? #111

smartkrio opened this issue Feb 13, 2015 · 1 comment

Comments

@smartkrio
Copy link

I use ActiveJob with resque_history plugin for monitoring done tasks.

Firstly I include this string require _'resque-history/server'_ into routes file, and then I see new history tab in dashboard.

This is some code in _/app/jobs/welcome_email_job.rb_

require 'resque-history'

class WelcomeEmailJob < ActiveJob::Base
    extend Resque::Plugins::History
    @max_history = 200
    @queue = :email

    def perform(user)
         UserMailer.welcome_email(user).deliver_now
         puts "I delivered mail to #{user.login} now, sincerly yours Resque <3"
    end
end

When job was done, I see in stats tab how many jobs was processed, but history tab empty, just only table head. Can I resolve this trouble?

@carsonreinke
Copy link

Yes, just add this to an initializer:

ActiveJob::QueueAdapters::ResqueAdapter::JobWrapper.class_eval do
  extend Resque::Plugins::History
end

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

No branches or pull requests

2 participants