title: Resque - Not Processing Queue
body: <p>I have an web based app that I built using Sinatra. From recent I was needing to collect data at regular intervals and store them in a database. For this I was told that I could use <code>Resque</code> and <code>Clockwork</code> gems in combine.</p>
  
  <p>Every hour or so I need to do nearly 15 calculations based on the database and store the results in a database.</p>
  
  <p>So this is the approach I took. I decided to make 15 classes that have the <code>perform</code> method ( the exact file I used for testing is below ). Then to do some thing similar to <code>Resque.enqueue( GraphData )</code> for all 15 classes.</p>
  
  <pre><code>class GraphData
  
    @queue = :graph_data
  
    def self.init()
  
    end
  
    def self.perform()
      File.open( '/home/ziyan/Desktop/resque.txt', 'a' ) { | file | file.write( "Resqueu - performed - #{Time.now}\n" ) }
    end
  
  end
  </code></pre>
  
  <p>To trigger the operation for testing purposes, I created a rake task.</p>
  
  <pre><code>desc "Start Resque Workers for Queue" # {{{
  task :graph_data do |t|
  
    ENV["QUEUE"]      = "*"
    ENV["VVERBOSE"]   = "1"
    ENV["INTERVAL"]   = "5"
  
    Resque.enqueue( GraphData )
    #resque = Resque.new
    #resque &lt;&lt; AdminWorker.new
  end # }}}
  </code></pre>
  
  <p>As you see, in the <code>GraphData</code> class, under <code>self.perform</code> method I am writing to a file.</p>
  
  <p>My problem is it doesn't! Have I done some thing wrong?</p>
  
  <p><code>rake graph_data</code> will show no output. The web interface will show a job in the <code>Queue</code>.</p>
  
  <p><strong>Additional Information</strong></p>
  
  <p>I added another <code>Rake</code> task for running the web interface.</p>
  
  <pre><code>desc "Start Resque Web Frontend" # {{{
  task :resque_web_frontend do |t|
    sh "resque-web -p 8282"
    puts "Resque Web Frontend is running on http://localhost:8282"
  end # }}
  </code></pre>
  
  <p>Over their, some thing interesting is seen. As I run the rake task, under <code>stats</code> the <code>pending</code> value increases but not the processed.</p>
  
  <p>Under queues -> graph_data I see some thing like this.</p>
  
  <pre><code>Class   Args
  GraphData   []
  GraphData   []
  GraphData   []
  </code></pre>
  
  <p><strong>What I ended up with</strong>: </p>
  
  <pre><code>desc "Start Resque Workers for Queue" # {{{
  task :graph_data do |t|
  
    ENV["QUEUE"]      = "*"
    ENV["VVERBOSE"]   = "1"
    ENV["INTERVAL"]   = "5"
  
    Rake::Task[ "resque:work" ].invoke
    Resque.enqueue( GraphData )
    #resque = Resque.new
    #resque &lt;&lt; AdminWorker.new
  end # }}}
  </code></pre>