delayed-job

Rails 3/delayed_job - Wanted: Basic example of delayed mail

≡放荡痞女 提交于 2019-12-18 12:45:54
问题 I've been trying to figure out how to send delayed mail using delayed_job with rails 3. I've tried pretty much every combination of feasible possibilities I can think of - I can get the mail to run in the background, I just can't get it to delay the sending to a future time. The delayed_jobs table in the db clears the tasks, the log says 'sent', the delayed_job task processor picks up the task & says sent without failure...but the mail is either: sent immediately, or simply doesn't arrive if

Manually Retry Job in Delayed_job

不羁的心 提交于 2019-12-18 10:08:29
问题 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. 回答1: To manually call a job Delayed::Job.find(10).invoke_job # 10 is the job.id This does not remove the job if it is run successfully. You need to remove it manually: Delayed:

Rails Delayed Job & Library Class

断了今生、忘了曾经 提交于 2019-12-17 18:59:31
问题 Hey we have a library class (lib/Mixpanel) that calls delayed job as follows: class Mixpanel attr_accessor :options attr_accessor :event def track!() .. dj = send_later :access_api # also tried with self.send_later .. end def access_api .. end The problem is that when we run rake jobs:work: we get the following error: undefined method `access_api' for #<YAML::Object:0x24681b8> Any idea why? 回答1: Delayed_job always autoloads ActiveRecord classes, but it doesn't know about other types of

Rails Delayed Job & Library Class

心已入冬 提交于 2019-12-17 18:57:25
问题 Hey we have a library class (lib/Mixpanel) that calls delayed job as follows: class Mixpanel attr_accessor :options attr_accessor :event def track!() .. dj = send_later :access_api # also tried with self.send_later .. end def access_api .. end The problem is that when we run rake jobs:work: we get the following error: undefined method `access_api' for #<YAML::Object:0x24681b8> Any idea why? 回答1: Delayed_job always autoloads ActiveRecord classes, but it doesn't know about other types of

Best Ruby on Rails Architecture for Image Heavy App

醉酒当歌 提交于 2019-12-17 17:29:30
问题 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 images CarrierWave: Processes images and resizes them with ImageMagick Amazon S3: CarrierWave uploads images to Amazon S3 through Fog Heroku: for hosting I'd like to allow users to be able to drag and drop a large amount of images onto a page, and then navigate to

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

北城以北 提交于 2019-12-14 03:42:09
问题 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

delayed_job - Performs not up to date code?

怎甘沉沦 提交于 2019-12-13 14:37:23
问题 I'm using delayed_job (tried both tobi's and collective_idea's) on site5.com shared hosting, with passenger as rails environment. I managed to make jobs done. However, it seems the plugin ignores any changes in a job class source code after first run. I have restarted the server on every change ( touch tmp/restart.txt ) but it still ignores it. Example: file: lib/xx_job.rb class XxJob def perform Rails.logger.info "XX START" TempTest.delete_all i = 0 10.times { i+=1 TempTest.create(:name =>

Issue with rufus-scheduler when we have multiple EC2 instances

女生的网名这么多〃 提交于 2019-12-13 04:25:00
问题 I have deployed rails app on two EC2 instances. I have scheduled on Job with rufus-scheduler to run every 24 hours to send some emails. But scheduler is running separately on two instances. I need run scheduler on only one instance. So can you please help with this issue? Thanks 回答1: Let's assume you've followed https://github.com/jmettraux/rufus-scheduler#so-rails You could modify the initializer in this way: # # config/initializers/scheduler.rb require 'rufus-scheduler' s = Rufus::Scheduler

Exclude queue from delayed_job worker

时光总嘲笑我的痴心妄想 提交于 2019-12-12 15:52:22
问题 In delayed_jobs it is possible to run a worker for a specific queues. I can't seem to find any examples/documentation on how to run a worker and exclude a specific queue. I am trying to have 1 worker for super high priority stuff and 1 that handles the rest. Is the only way to achieve this by specifying what queues relate to what worker? Is there no way to spawn a worker that runs all queues except queue_x? 来源: https://stackoverflow.com/questions/46073051/exclude-queue-from-delayed-job-worker

ActionMailer “Net::ReadTimeout” when using Delayed Job with Rackspace “emailsrvr.com”

安稳与你 提交于 2019-12-12 14:32:17
问题 Edit: I'm using Rails 3.2.17 and Ruby 2.0.0p0 I've been having some issues with ActionMailer timing out on sending mail; See ActionMailer Timing out After increasing the default Unicorn timeout to 2min (for testing) It completes in about 45 sec. I thought the best way to handle this would be to use Delayed Job , however, when DJ runs the deliver method it's timing out too. Stack trace below. Is DJ the right tool for the job? Do I need to increase the timeout for DJ (I thought that I had read