delayed-job

How to run some tasks in the background and put the results to a global memory hash?

I'm building a website with Rails which can let user check if some domains have been registered. The logic is designed like this: There is a text field on a page let users input some domain names When user click check button, the input will be post to the server server get the inputs, create a background task(which will be executed in ...

Callback after delayed_job process job

I need to update a model after delayed_job processes a task on it, e.g: foo.delay.something After something is done, I need to update the foo object, what is the best way to achieve this? I was thinking in coding a callback on the Delayed::Backend::ActiveRecord::Job class, but there's should be something cleaner and better to do this. ...

background job vs after_save callback

I have a model called Vote that gets changed very frequently (people voting on stuff). I do other analytics after a vote is save, such as interpolating if the voter is male/female, what age etc. This results in updating counters in (adult votes, women votes etc) the same model. I wonder what's the best way to do this after save process...

Recurring Tasks in Delajed Jobs without firing up Rails?

Hi guys, If I need to create recurring tasks in delayed jobs, what is a clean solution? I have an import task that I want to run every 5 minutes, but I don't want to fire up rails/rake in order to tell it to create a Delayed job that can be picked up. If Rails is already running on a system, perhaps I can just create an HTTP request tha...

Is there a delayed_job like gem for jruby?

I'm trying to convert a rails app to jruby on rails. Currently, jruby script/delayed_job run gives: /usr/lib/jruby/lib/ruby/gems/1.8/gems/delayed_job-2.0.3/lib/delayed/command.rb:50:in `each_object': ObjectSpace is disabled; each_object will only work with Class, pass -X+O to enable (RuntimeError) from /usr/lib/jruby/lib/ruby/gems/1...

Manually Retry Job in Delayed_job

Delayed::Job's auto-retry feature is great, but there's a job that I want to manually retry now. Is there a method I can call on the job itself like... Delayed::Job.all[0].perform or run, or something. I tried a few things, and combed the documentation, but couldn't figure out how to execute a manual retry of a job. ...

Why do sites like stackoverflow with badges use some type of delayed job to determine when to award a new badge?

Stackoverflow has a nifty badge system. One thing I noticed is that badges are not immediately awarded, but sometimes seem to have some type of a delay after I meet the criteria. I've noticed this on some other sites that have badges as well. Presumably this is because they are using a delayed job that scans periodically to see if any n...

delayed_job restart from capistrano

Here is what I have in my enviornment.rb. I understand there have been issues with restarting because of a bug in the "daemons" gem and that the ghazel-daemons fixes it. But its not working in my case. I am using the collectiveidea 2.1.0--pre version of DJ, rails 2.3.5. config.gem 'delayed_job', :source => 'http://rubygems.org', :versio...

How do I silence the delayed_job output in test?

I am using delayed_job for background tasks such as system e-mails and different timed events. I use Delayed::Worker.new.work_off to work off the events in my RSpec tests, but then the test out put gets littered with sh*t like: [Worker(host:ch.local pid:24307)] RPM Monitoring DJ worker host:ch.local pid:24307 [Worker(host:ch.local pid...

More Advanced Control Over Delayed Job workers retry

So I'm using Delayed::Job workers (on Heroku) as an after_create callback after a user creates a certain model. A common use case, though, it turns out, is for users to create something, then immediately delete it (likely because they made a mistake or something). When this occurs the workers are fired up, but by the time they query ...

A Faster / More Scalable Approach to Twitter OAuth Dance in Rails?

I'm running a Rails app on the Heroku Stack (complete with Memcached, DJ Asynchronous workers, MongoDB persistent storage). Right now we use Twitter Oauth as the only authentication option on our site. (We plan to branch out to FB connect, OpenID, and/or Email/password eventually). Ruby/Rails apps, as you probably know, don't support c...

Rails Devise send password reset mail as delayed job

i want set the rails plugin devise'reset_password_instructions to delayed_job..but i tried many ways is fail. i found a function password_controller#creat they have self.resource = resource_class.send_reset_password_instructions(params[resource_name]) i think the sentence used for send email to reset password. i want alter it like ...

Terminal says delayed_job starting, but not doing anything

I have an app that works perfectly on my local machine and am deploying it now. I have the VPS all set up and it pretty much works, as well. My problem comes from not being able to start delayed_job. I do the "ruby script/delayed_job start RAILS_ENV=production" while SSHd to the app and it returns "delayed_job: process with pid 11547 sta...

Avoiding use of 'requires' in my delayed_job classes in /lib folder

I have a class in my /lib folder that my delayed_job daemon calls to work on an object of type Foo. If I don't have a "requires 'foo'" in the worker class then it doesn't know what to do with the YAML it gets from the DB and I get the "undefined method" error. Adding in "requires 'foo'" will obviously fix this, which is the usual solutio...

Ruby on Rails: Thinking Sphinx Delayed Delta Isn't Working by Following Documentation

Following the delayed delta guide here (at the bottom) I did everything that the documentation asked. After I did all of the steps there, I ran a rake ts:rebuild and a rake ts:dd and attempted to load my app (development). When it loads, I get: NameError in CustomersController#index uninitialized constant ThinkingSphinx::Deltas::Delaye...

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", Rails.logger.level) Delayed::Worker.logger.auto_flushing = 1 class Delayed::Job def logger Delayed::Worker.l...

Memory Leak Rails/Delayed Job

What sort of tools are available to monitor memory usage in methods running from delayed_job? I have looked at memorylogic, oink, bleakhouse but they all either seem designed to work with controllers or I am missing something. Any examples of how delayed_job memory leaks (not with the gem itself but the code it is running) are detected ...

Any job queue systems that allow scheduling jobs by date?

I have a Django application. One of my models looks like this: class MyModel(models.Model): def house_cleaning(self): // cleaning up data of the model instance Every time when I update an instance of MyModel, I'd need to clean up the data N days later. So I'd like to schedule a job to call this_instance.house_cleaning() ...

rails high memory usage

I am planning on using delayed job to run some background analytics. In my initial test I saw tremendous amount of memory usage, so I basically created a very simple task that runs every 2 minutes just to observe how much memory is is being used. The task is very simple and the analytics_eligbile? method always return false, given where...

background task with multiple workers sharing one rails instance in memory

I need to query mulitple apis to get certain data for each user. I need to do this as a background task. Now there are a lot of users. And ideally I would like all this to happen in parallel. So I could insert a job of each user/api combination. And say have 4 delayed_job workers process all the jobs. The problem I am facing with this,...