Created
April 4, 2012 18:58
-
-
Save vpamulap/2304749 to your computer and use it in GitHub Desktop.
Resque Status Hash Problem
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
Added in gemfile: | |
gem 'resque-status' | |
My Initializer: resque.rb | |
require 'resque/job_with_status' | |
Resque.redis = 'localhost:6379' | |
Resque::Plugins::Status::Hash.expire_in = (24 * 60 * 60) | |
________________________________________________ | |
Job: | |
class Myjob | |
include Resque::Plugins::Status | |
def perform | |
puts status.inspect | |
status["a"] = "b" | |
status["c"] = "d" | |
puts status.inspect | |
sleep(5) | |
puts status.inspect | |
end | |
end | |
_________________________________________ | |
Job called in action: | |
jobid = Myjob.create().to_s | |
_________________________________________ | |
Worker Output: | |
#<Resque::Plugins::Status::Hash {"time"=>1333566122, "status"=>"working", "uuid"=>"961f51e060b6012f1d90388d122a27ec", "options"=>{}, "name"=>"Myjob()"}> | |
#<Resque::Plugins::Status::Hash {"time"=>1333566122, "status"=>"working", "uuid"=>"961f51e060b6012f1d90388d122a27ec", "options"=>{}, "name"=>"Myjob()"}> | |
#<Resque::Plugins::Status::Hash {"time"=>1333566122, "status"=>"working", "uuid"=>"961f51e060b6012f1d90388d122a27ec", "options"=>{}, "name"=>"Myjob()"}> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment