delayed-job

Delay sending an email using Mandrill send_at or Celery countdown/eta

我怕爱的太早我们不能终老 提交于 2020-01-02 08:11:06
问题 I commonly send transactional emails in response to certain actions on my website, some of which I delay sending by a couple of hours. The function that actually queues the email is a Celery task function called with .delay() that eventually makes an API call to Mandrill using djrill. I discovered that Mandrill offers a send_at parameter when sending an email that will have Mandrill delay sending the email until the specified time. Celery also offers eta or countdown parameters when calling

How to make Delayed_Job notify Airbrake when an ActionMailer runs into an error?

假如想象 提交于 2020-01-01 04:23:08
问题 The DelayedJob docs mention hooks, including an error hook, but only in the context of custom Job subclasses. This similar question (with no answers) says adding the same hook to the mailer class did not work. What's the trick? Update: In general, I'd like to see how to add hooks to jobs that are triggered using the object.delay.action() syntax, where I don't see an obvious link to a ____Job class. 回答1: I was just searching for a solution to this problem too, and I found this gist. I don't

Delayed Job not logging in Production

▼魔方 西西 提交于 2019-12-31 22:36:32
问题 I want my delayed job "code" to log in a different log file for business requirements. So I log a custom status in a log called as dj.log. Inside the "serialized" job, I am putting the log statements to log in my file. Here is how the setup is Delayed::Worker.destroy_failed_jobs = false Delayed::Worker.sleep_delay = 60 Delayed::Worker.max_attempts = 10 Delayed::Worker.delay_jobs = !( Rails.env.test? || Rails.env.development? ) #dont use delayed_job in development or test mode #Delayed_job

Invoke delayed_job capistrano tasks only on specific servers

喜你入骨 提交于 2019-12-31 22:27:34
问题 I have a dedicated server for delayed_job tasks. I want to start, stop, and restart delayed_job workers on only this server. I am using the capistrano recipes provided by delayed_job. When I only had 1 server, this was my config: before "deploy:restart", "delayed_job:stop" after "deploy:restart", "delayed_job:start" after "deploy:stop", "delayed_job:stop" after "deploy:start", "delayed_job:start" Now I want to have those hooks only apply to a separate delayed_job server ( role :delayed_job

Delayed job wont start using Capistrano

与世无争的帅哥 提交于 2019-12-31 13:56:40
问题 I cannot start delayed job process using a capistrano recipe. Here's the error I am getting. /usr/local/lib/ruby/gems/1.9.1/gems/delayed_job-2.1.1/lib/delayed/command.rb:62:in `mkdir': File exists - /my_app/server/releases/20101120001612/tmp/pids (Errno::EEXIST) Here's the capistrano code (NOTE-: I have tried both start/restart commands) after "deploy:restart", "delayed_job:start" task :start, :roles => :app do run "cd #{current_path}; RAILS_ENV=#{rails_env} script/delayed_job -n 2 start" end

Delayed job wont start using Capistrano

人盡茶涼 提交于 2019-12-31 13:56:19
问题 I cannot start delayed job process using a capistrano recipe. Here's the error I am getting. /usr/local/lib/ruby/gems/1.9.1/gems/delayed_job-2.1.1/lib/delayed/command.rb:62:in `mkdir': File exists - /my_app/server/releases/20101120001612/tmp/pids (Errno::EEXIST) Here's the capistrano code (NOTE-: I have tried both start/restart commands) after "deploy:restart", "delayed_job:start" task :start, :roles => :app do run "cd #{current_path}; RAILS_ENV=#{rails_env} script/delayed_job -n 2 start" end

Run delayed jobs after deployed on production server

别等时光非礼了梦想. 提交于 2019-12-31 04:51:06
问题 With the delayed_jobs gem(https://github.com/collectiveidea/delayed_job) in rails, I am able to queue my notifications. But I don't quite understand how can I run the queued jobs on the production server. I knew I can just run $ rake jobs:work in the console for the local server. As the documentation said, You can then do the following: RAILS_ENV=production script/delayed_job start RAILS_ENV=production script/delayed_job stop # Runs two workers in separate processes. RAILS_ENV=production

Initialize the Delayed Jobs gem by starting the workers on application start

眉间皱痕 提交于 2019-12-30 11:35:43
问题 I am using Ruby on Rails 3.0.9 and I am trying to setup the delay_job gem. All works if, after rebooting the Apache2 server, I run in the Terminal\Console following commands: RAILS_ENV=development script/delayed_job stop RAILS_ENV=development script/delayed_job -n 2 start However, since I always want to start the workers on application start, in my config/initializers/delayed_job.rb I add the following code (that handles both development and production mode): if Rails.env.development? system

Running delayed_job as a windows service

旧巷老猫 提交于 2019-12-30 09:34:35
问题 I am trying to get delayed_job working as a windows service. I am so thoroughly sick of windows I can't even begin to put it into words, but I am stuck with it for now due to 3rd party dependencies. Running rake jobs:work starts the worker in a console with no problems. I've created an empty windows service to start and shutdown the worker using sc create DelayedJobWorker... . However, I can't get the service to start and stop the worker. I'm not sure what the best approach is - what I should

Rails delayed job not working

人盡茶涼 提交于 2019-12-29 09:21:59
问题 My delayed job is not working. I am trying to create an background task for a rake file using a delayed job that should run every 15 minute. I have copied my rake tasks in my rake file and set them in my controller as methods. I need an delayed job because heroku only makes a cron every 1 hour. Here is my Application controller: class ApplicationController < ActionController::Base require 'delayed_job' require 'Mechanize' require 'pp' protect_from_forgery def iqmedier agent = WWW::Mechanize