Forked from anonymous/background_job_checker.rb
Last active
December 12, 2015 03:48
-
-
Save radar/4709334 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BackgroundJobChecker | |
def self.check | |
Resque::Plugins::Status::Hash.statuses.each do |job| | |
return !job.working? | |
end | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "background_job_checker" | |
class Device < ActiveRecord::Base | |
before_create :check_background_job | |
def check_background_job | |
BackgroundJobChecker::check | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment