delayed-job

delayed_jobs save completed jobs

此生再无相见时 提交于 2019-12-05 04:23:35
Is there a parameter I can pass to delayed_job that will prevent it from deleting completed jobs from the delayed_jobs table? kind of like the destroy_failed_jobs but for completed jobs any ideas? It doesn't appear so. From the README: https://github.com/tobi/delayed_job By default, it will delete failed jobs (and it always deletes successful jobs). If you want to keep failed jobs, set Delayed::Job.destroy_failed_jobs = false. The failed jobs will be marked with non-null failed_at. You would probably need to hook into its destroy method such that it copies the job to another, separate table

NoMethodError with delayed_job (collectiveidea gem)

心已入冬 提交于 2019-12-05 00:49:21
UPDATE: There's been a patch for this issue: https://github.com/collectiveidea/delayed_job/commit/023444424166ba2ce011bfe2d47954e79edf6798 UPDATE 2: For anyone running into this issue on Heroku specifically, I've found downgrading to Rake 0.8.7 and using Delayed Job version 2.1.4 works, while delayed job v3 does not (though with the patch it does work on local). This is on the Bamboo-mri-1.9.2 stack. I am trying to implement delayed_job on a rails 3.1.0 app locally. I ran the migration and installed the gem files: gem 'delayed_job' gem 'delayed_job_active_record' Following the documentation on

Delayed Job: Configure run_at and max_attempts for a specific job

荒凉一梦 提交于 2019-12-04 19:17:29
问题 I need to overwrite the Delayed::Worker.max_attempts for one specific job, which I want to retry a lot of times. Also, I don't want the next scheduled time to be determined exponentially (From the docs: 5 seconds + N ** 4, where N is the number of retries). I don't want to overwrite the Delayed::Worker settings, and affect other jobs. My job is already a custom job (I handle errors in a certain way), so that might be helpful. Any pointers on how to do this? 回答1: I figured it out by looking

Delayed_job (2.1.4) error: Job failed to load: instance of IO needed. Handler nil

我与影子孤独终老i 提交于 2019-12-04 19:03:45
I created a simplistic achievements system and wanted to introduce delayed_job (2.1.4) to take care of the processing. However, the handler column in the delayed_jobs table is always nil, which results in the last_error text: Job failed to load: instance of IO needed. Handler nil Here is my setup: Achievement Observer class AchievementObserver < ActiveRecord::Observer observe User, Comment, ... def after_create(record) # initiate delayed job to check conditions Delayed::Job.enqueue(TrophyJob.new(record.id, record.class.name)) end ... end Trophy Job class TrophyJob < Struct.new(:record_id,

PaperTrail: info_for_paper_trail outside the context of a controller

佐手、 提交于 2019-12-04 10:53:42
I am using the paper_trail gem for versioning my models. So far, my model depends on the info_for_paper_trail method in ApplicationController : class ApplicationController < ActionController::Base # Extra columns to store along with PaperTrail `versions` def info_for_paper_trail { revision_id: @revision.id, revision_source_id: @revision_source.id } end end This works great in context of the controller, but is there a way that I can replicate this sort of thing outside the context of the controller (e.g., a delayed job)? I tried creating a virtual attribute called revision and passing a proc

Best practice for processing a lot of data while the user waits (in Rails)?

亡梦爱人 提交于 2019-12-04 09:02:34
I have a bookmarklet that, when used, submits all of the URLs on the current browser page to a Rails 3 app for processing. Behind the scenes I'm using Typhoeus to check that each URL returns a 2XX status code. Currently I initiate this process via an AJAX request to the Rails server and simply wait while it processes and returns the results. For a small set, this is very quick, but when the number of URLs is quite large, the user can be waiting for up to, say, 10-15 seconds. I've considered using Delayed Job to process this outside the user's thread, but this doesn't seem like quite the right

How to solve the “You need to add gem 'daemons' to your Gemfile if you wish to use it” error in production mode?

时光总嘲笑我的痴心妄想 提交于 2019-12-04 07:48:06
I am trying to properly use Capistrano and RVM in order to deploy my Ruby on Rails 3.2.2 application to the remote machine that is running Ubuntu 10.04 LTS. It seams that I solved my previous problem related to the " Rvm - Capistrano integration on Linux Ubuntu ". However, on deploying I get the following error related to the DelayedJob gem: ... * executing "cd /srv/www/<APP_NAME>/releases/20120314135318 && bundle install" servers: ["<DOMAIN>"] [<DOMAIN>] executing command [<DOMAIN>] rvm_path=/usr/local/rvm /usr/local/rvm/bin/rvm-shell 'ruby-1.9.3-p125' -c 'cd /srv/www/<APP_NAME>/releases

rufus-scheduler and delayed_job on Heroku: why use a worker dyno?

早过忘川 提交于 2019-12-04 07:28:00
I'm developing a Rails 3.2.16 app and deploying to a Heroku dev account with one free web dyno and no worker dynos. I'm trying to determine if a (paid) worker dyno is really needed. The app sends various emails. I use delayed_job_active_record to queue those and send them out. I also need to check a notification count every minute. For that I'm using rufus-scheduler. rufus-scheduler seems able to run a background task/thread within a Heroku web dyno. On the other hand, everything I can find on delayed_job indicates that it requires a separate worker process. Why? If rufus-scheduler can run a

Knowing when resque worker had completed job

烂漫一生 提交于 2019-12-04 06:25:13
问题 I am performing some job with Resque-worker (5 workers). Now, when this job is completed/done I want to trigger another worker which processes the data previous worker stored in db. What would be the most appropriate method of doing this? 回答1: I'm not sure if this is of any help, but have you had a look at the resque-status gem? That way you can track a given jobs' status, to see when it is completed. But I'm affraid there are no auto-trigger functionality, to start new workers. 来源: https:/

Delayed Job giving a undefined method error

帅比萌擦擦* 提交于 2019-12-04 06:24:14
Delayed job (2.1.4) is working perfectly on my development machine, sending emails with gay abandon - however it is failing miserably when running on my server using Apache/Passenger(3.0.7). Rails 3.0.7 and ruby 1.9.2 on both btw. I have seen that there is a problem when using thin where the job is created like this: --- !ruby/struct:Delayed::PerformableMailer object: !ruby/object:Class UserMailer when it should read: --- !ruby/struct:Delayed::PerformableMailer object: !ruby/class UserMailer Mine are created correctly on my development machine, but the wrong way when created on the server. Has