Questions tagged [resque]

Resque (pronounced like "rescue") is a Redis-backed library for creating background jobs, placing those jobs on multiple queues, and processing them later.

Background jobs can be any Ruby class or module that responds to perform. Your existing classes can easily be converted to background jobs or you can create new classes specifically to do work. Or, you can do both.

Resque is heavily inspired by DelayedJob (which rocks) and comprises three parts:

A Ruby library for creating, querying, and processing jobs A Rake task for starting a worker which processes jobs A Sinatra app for monitoring queues, jobs, and workers. Resque workers can be distributed between multiple machines, support priorities, are resilient to memory bloat / "leaks," are optimized for REE (but work on MRI and JRuby), tell you what they're doing, and expect failure.

Resque queues are persistent; support constant time, atomic push and pop (thanks to Redis); provide visibility into their contents; and store jobs as simple JSON packages.

The Resque frontend tells you what workers are doing, what workers are not doing, what queues you're using, what's in those queues, provides general usage stats, and helps you track failures.

For the backstory, philosophy, and history of Resque's beginnings, please see the blog post.

1074 questions
22
votes
1 answer

Rails: Exception in after_create stopping save

Simple question. I have a ActiveRecord model that I want to perform post processing on AFTER the record is saved. So in the model I have a queue_for_processing method that sticks a job onto my Resque queue. To make this execute after my record is…
James P McGrath
  • 1,856
  • 1
  • 20
  • 35
22
votes
2 answers

What is the proper way to setup and use php-resque?

I am trying to use php-resque to queue and execute ffmpeg conversions on my server. I understand broadly how it should work, but I am having some trouble with the details and can not find any tutorials. Specifically, I don't understand where I…
user1461465
21
votes
5 answers

Gems/Services for autoscaling Heroku's dynos and workers

I want to know if there are any good solutions for autoscaling dynos AND workers on Heroku in a production environment (probably a different solution for each of those, as they are pretty unrelated). What are you/companies using, regarding this? I…
FernandoH
  • 855
  • 1
  • 9
  • 17
20
votes
5 answers

Rails Resque workers fail with PGError: server closed the connection unexpectedly

I have site running rails application and resque workers running in production mode, on Ubuntu 9.10, Rails 2.3.4, ruby-ee 2010.01, PostgreSQL 8.4.2 Workers constantly raised errors: PGError: server closed the connection unexpectedly. My best guess…
gc.
  • 203
  • 2
  • 4
19
votes
2 answers

How to test retries and failures in resque-retry and Rails 4?

I am trying to write a spec that tests the retry functionality of resque-retry and I can not seem to get the tests to hit the binding.pry's correctly. Is there a way to test this functionality using rspec 3 so I can verify they are functioning as…
Chris Hough
  • 3,389
  • 3
  • 41
  • 80
19
votes
2 answers

How to check Resque worker status to determine whether it's dead or stale

The default resque web interface says that I have 5 of 7 workers working. I don't understand how this could be happening. I'm on heroku, so when my dyno restarts, it should spin down existing dynos and workers, then spin up new ones. So, I'm…
boo-urns
  • 10,136
  • 26
  • 71
  • 107
19
votes
3 answers

deploying redis to heroku unable to connect

ive been trying to get resque to work with heroku. i can successfully get it to work in development mode, however when i try pushing to heroku i get Errno::ECONNREFUSED (Connection refused - Unable to connect to Redis on 127.0.0.1:6379): i then…
Sasha
  • 3,281
  • 7
  • 34
  • 52
16
votes
1 answer

Resque.enqueue failing on second run

I am trying to port an app from Rails 3.0.3 to Rails 3.1rc... I don't think I've missed out anything, in terms of configuration. The process works perfectly in Rails 3.0.X and not in 3.1rc. In console, I do: Resque.enqueue(EncodeSong,…
Christian Fazzini
  • 19,613
  • 21
  • 110
  • 215
16
votes
1 answer

How to ignore some calls to the same method with different argument in Rspec?

This is my scenario: After updating an AR object, it fires a bunch of background jobs with Resque. In my specs I’m mocking the call to Resque#enqueue, something in the lines of: it 'should be published' do # I need to setup these mocks in many…
rdavila
  • 370
  • 3
  • 9
16
votes
2 answers

Resque multiple workers in development mode

Hi is it possible to run multiple Resque workers simultaneously in development? I found this bit of code, but not sure if it will work and how.. http://pastebin.com/9GKk8GwR So far I am using the standard bundle exec env rake resque:work…
Stpn
  • 6,202
  • 7
  • 47
  • 94
15
votes
5 answers

Recovering cleanly from Resque::TermException or SIGTERM on Heroku

When we restart or deploy we get a number of Resque jobs in the failed queue with either Resque::TermException (SIGTERM) or Resque::DirtyExit. We're using the new TERM_CHILD=1 RESQUE_TERM_TIMEOUT=10 in our Procfile so our worker line looks…
Brian Armstrong
  • 19,707
  • 17
  • 115
  • 144
14
votes
4 answers

Postgres error on Heroku with Resque

I don't know enough Postgres to understand the message. PG::Error: SSL error: decryption failed or bad record mac : SELECT a.attname, format_type(a.atttypid, a.atttypmod), d.adsrc, a.attnotnull FROM pg_attribute a LEFT JOIN pg_attrdef d ON…
Arkan
  • 6,196
  • 3
  • 38
  • 54
14
votes
2 answers

Resque jobs, how to stop running job

My Resque worker class class WebWorker @queue = :jobs_queue def self.perform(id) //bunch of code here end end I remove from the queue a certain job like this Resque.dequeue(WebWorker,id) But I would like to stop running job and restart,…
Aydar Omurbekov
  • 2,047
  • 4
  • 27
  • 53
14
votes
2 answers

Best Ruby on Rails Architecture for Image Heavy App

I'm building an application that allows for large amounts of photo uploads at once, and wanted to know what the best setup would be to tackle this. This is what I am using so far: Jquery File Upload: allows users to drag and drop…
14
votes
0 answers

Resque vs. Sidekiq

I'm working on a project with a friend where we've been using Resque for processing various commands from data input inside our rails application on a minute to minute basis. We've been messing around with the idea of using Sidekiq because it is…
James Newton
  • 402
  • 4
  • 14
1
2
3
71 72