Questions tagged [delayed-job]

A Ruby library to queue and defer processing of slow methods like sending email and image resizing.

Delayed_job (or DJ) encapsulates the common pattern of asynchronously executing longer tasks in the background.

It is a direct extraction from Shopify where the job table is responsible for a multitude of core tasks. Amongst those tasks are: •sending massive newsletters •image resizing •http downloads •updating smart collections •updating solr, our search server, after product changes •batch imports •spam checks

1613 questions
27
votes
2 answers

Node.js workers/background processes

How can I create and use background jobs in node.js? I've come across two libs (node-resque and node-worker) but would like to know if there's something more used.
donald
  • 23,587
  • 42
  • 142
  • 223
26
votes
6 answers

How to make ExceptionNotifier work with delayed_job in Rails 3?

I'd like ExceptionNotifier to send out an email when an exception happens in a delayed job, just like for other exceptions. How can I achieve that?
Alex Korban
  • 14,916
  • 5
  • 44
  • 55
25
votes
2 answers

How can I debug code running in a delayed_job task in the IRB console?

I have a background task that runs using delayed_job. I can see that it does run from the logging statements. It does not seem to have the correct result, compared to running it in the foreground, so I want to debug it in the IRB console. I am…
s01ipsist
  • 3,022
  • 2
  • 32
  • 36
24
votes
5 answers

Rails/Rspec: Testing delayed_job mails

Just wondering how to test that actionmailer requests are actually sent to the delayed_job que in rspec. I would have assumed it was quite simple, but my delayed_job queue doesn't seem to be incrementing. Code below: Controller: def create …
PlankTon
  • 12,443
  • 16
  • 84
  • 153
22
votes
6 answers

Getting delayed job to log

#Here is how I have delayed job set up. Delayed::Worker.backend = :active_record #Delayed::Worker.logger = Rails.logger Delayed::Worker.logger = ActiveSupport::BufferedLogger.new("log/ ##{Rails.env}_delayed_jobs.log",…
badnaam
  • 1,876
  • 4
  • 29
  • 53
21
votes
6 answers

uninitialized constant Delayed::Job

I've added the delayed_job gem to my gemfile and installed correctly but when I try to run the following line: Delayed::Job.enqueue do_it(), 0, 1.minutes.from_now.getutc I get the error 'uninitialized constant Delayed::Job' Can somebody explain…
Gerard
  • 4,818
  • 5
  • 51
  • 80
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
21
votes
1 answer

Rails + Delayed Job: Where is the correct place to store custom job classes?

I'm new to delayed_job and i'm starting to write my own "custom jobs". Each custom job is basically just a regular ruby class but i'm not sure where these custom job classes are normally stored within the project's directory structure. I'm thinking…
Mario Zigliotto
  • 8,315
  • 7
  • 52
  • 71
20
votes
3 answers

Delayed_job - Multiple parallel queues?

I am using delayed_job and moved to a new beefier server. So now I would like to run parallel jobs, as now I have the POWER!, but am confused on whether delayed_job can run multiple parallel queues? This question suggested that there are named…
slotishtype
  • 2,715
  • 7
  • 32
  • 47
19
votes
5 answers

Running delayed jobs on Heroku for free

Is it possible to run delayed jobs on Heroku for free? I'm trying to use delayed_job_active_record on Heroku. However, it requires a worker dyno and it would cost money if I turned this dyno on for full time. I thought using Unicorn and making its…
Maximus S
  • 10,759
  • 19
  • 75
  • 154
18
votes
1 answer

how to query delayed_job handler

I'm playing with delayed_job and I need to delete all the job with a specified handler value, I tried in this way class Auction < ActiveRecord::Base def clean_jobs Delayed::Job.all.each do |job| job.delete if…
Mattia Lipreri
  • 953
  • 1
  • 16
  • 30
18
votes
6 answers

Long running delayed_job jobs stay locked after a restart on Heroku

When a Heroku worker is restarted (either on command or as the result of a deploy), Heroku sends SIGTERM to the worker process. In the case of delayed_job, the SIGTERM signal is caught and then the worker stops executing after the current job (if…
M. Scott Ford
  • 2,859
  • 1
  • 23
  • 24
17
votes
6 answers

Delayed_job not executing the perform method but emptying the job queue

I have a fresh rails 3 app, here's my Gemfile: source 'http://rubygems.org' gem 'rails', '3.0.0' gem 'delayed_job' gem 'sqlite3-ruby', :require => 'sqlite3' Here's the class that represents the job that I want to queue: class Me <…
James
  • 5,273
  • 10
  • 51
  • 76
17
votes
1 answer

Store file in directory tmp on heroku Rails

In my Delayed Job, I tried to create a file to tmp folder file_path = Rails.root.join('tmp', "#{file_name}." + file_extension); exported_file = kit.to_pdf # Save file to disk File.open(file_path, 'wb') do |file| file << exported_file end It…
ZeroX
  • 195
  • 1
  • 2
  • 7
17
votes
6 answers

Check whether the delayed job is running in rails

I am designing a status page where I need to show whether the delayed job is running. Please help me with a way to find it in the code. Am using Rails 3.0.20, ruby 1.8.7 (2011-06-30 patchlevel 352), and delayed_job 3.0.4
Virtual
  • 2,111
  • 5
  • 17
  • 27