delayed-job

How to automatically restart delayed_job when deploying a rails project on Amazon Elastic Beanstalk?

有些话、适合烂在心里 提交于 2019-12-28 05:35:08
问题 I'm hosting a rails project on Amazon Elastic Beanstalk and I try to configure a container command to automatically restart my delayed_job worker on the server after each deployment. I tried with this one : container_commands: restartdelayedjob: command: "RAILS_ENV=production script/delayed_job --pid-dir=/home/ec2-user/pids start" cwd: /var/app/current But, it seems that the pushed version is deployed after the restarting of the worker so the jobs failed to be processed by the worker. When I

Long running delayed_job jobs stay locked after a restart on Heroku

[亡魂溺海] 提交于 2019-12-28 02:39:11
问题 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 any) has stopped. If the worker takes to long to finish, then Heroku will send SIGKILL . In the case of delayed_job , this leaves a locked job in the database that won't get picked up by another worker. I'd like to ensure that jobs eventually finish

whenever + delayed_job with cron job in starting worker

烂漫一生 提交于 2019-12-25 08:16:22
问题 I am learning cron job and delayed job, and I want to send emails using background job; for that I'm using the delayed_job gem. I don't want to start the worker manually by running the rake jobs:work command, but I want to set this rake in cron job so whenever an user login into the dashboard this command is fired and a mail is sent to his address. Following is my code: Sending mail method def dashboard @user = User.find(params[:id]) UserMailer.delay.initial_email(@user) end UserMailer def

Ruby on Rails, delayed_job

陌路散爱 提交于 2019-12-24 20:29:48
问题 I am using this gem for my application. I cannot find parameters that I need.I have two functions in my controller: create and analyse. I want to run an analyse-method after 5 min when a create-method was called or I have one more function in a model: process I want to run an anylse-method (from contoller) after 5 min when a process-method was called. I have found smt like this: handle_asynchronously :in_the_future, :run_at => Proc.new { 5.minutes.from_now } but it does not say after wich

Can't figure out Delayed::DeserializationError

瘦欲@ 提交于 2019-12-24 14:08:25
问题 I am running delayed_job 3.0.5 (delayed_job_active_record 0.4.1) with Rails 3.2.12. I am having problems with some of my jobs failing because of "Deserialization". Here is a really simple example of one of the failing handlers: --- !ruby/struct:Delayed::PerformableMethod object: LOAD;Project;924951 method: :send_project_open_close_without_delay args: [] When I try to invoke this job: Delayed::DeserializationError: Job failed to load: undefined method `members' for nil:NilClass. Everyone seems

Delayed job not executed despite disappearing from delayed_jobs table immediately

≯℡__Kan透↙ 提交于 2019-12-24 11:28:35
问题 I implemented a delayed job in my Rails application, following the instructions. I start the Rails app I click on a link that launches the delayed job The job is visible in the database's delayed_jobs table I run rake jobs:work The job disappears from the table, so I guess the job has been performed BUT PROBLEM: /tmp/job.log has not been written (what the job should have done) The job: class CsvImportJob def perform File.open('/tmp/job.log', 'w') {|f| f.write("Hello") } end end The call: job

running fork in delayed job

别等时光非礼了梦想. 提交于 2019-12-24 10:48:53
问题 we use delayed job in our web application and we need multiple delayed jobs workers happening parallelly, but we don't know how many will be needed. solution i currently try is running one worker and calling fork/Process.detach inside the needed task. i was trying to run fork directly in rails application previously but it didnt work too good with passenger. this solution seems to work well. could there be any caveats in production? 回答1: one issue which happened to me today and which anyone

Job failed to load: uninitialized constant Syck::Syck

北慕城南 提交于 2019-12-24 08:25:53
问题 I am running a method in the background using delayed-job (collectiveideas fork) The method I am running is shown below, which fetches the price of the isbn: def update_prices(isbn13) @amazon = Nokogiri::XML(open("http://www.amazon.com/s/?url=search-alias%3Daps&field-keywords=#{isbn13}")) price = @amazon.search('span.listprice').first.text.gsub('$', '') book = Book.find_by_isbn13(isbn13) book.update_attribute(:amazon_us_price, price) end handle_asynchronously :update_prices Now when I run

Delayed job: How to process job sequentially (one after another)

久未见 提交于 2019-12-23 02:37:12
问题 I am running delayed job with command RAILS_ENV=production bin/delayed_job start . i am storing jobs with below code Delayed::Job.enqueue QrCodeGenerator.new(client,request,params[:batch_quantity].to_i) Currently delayed job is running jobs simeltanoulsy. i want know how to run job one after another. Thanks, 回答1: If this job is always gonna be the same job but just with different input parameters, you can just run QUEUE=myqueue rake jobs:work because that rake process will run one job at a

Rails: delayed_job mail not sending

╄→гoц情女王★ 提交于 2019-12-22 22:55:03
问题 I'm trying to use delayed_job gem https://github.com/collectiveidea/delayed_job in Rails 3.2 to send a mail in the background. I installed the gem gem 'delayed_job_active_record' I generated the table and ran the migrations, as instructed $ rails generate delayed_job:active_record $ rake db:migrate Noting that there are special instructions for mailers in Rails 3 # without delayed_job Notifier.signup(@user).deliver # with delayed_job Notifier.delay.signup(@user) I did def send_welcome_email