delayed-job

Indicate to an ajax process that the delayed job has completed

久未见 提交于 2019-11-30 06:50:22
问题 I have a Rails 3 app that uses delayed_job to fetch some data (with a class method) when the user hits the page. How can I indicate to the ajax process that the class method has run (so that I can stop polling)? EDIT: To clarify, I want to know when the delayed_job has run, not when the ajax process has succeeded. Then I want to pass the delayed_job completed status to the running ajax process. 回答1: Typically, the best way to do this is to store, in your database, an indication of the job's

Delayed_job not executing the perform method but emptying the job queue

自古美人都是妖i 提交于 2019-11-30 06:39:09
I have a fresh rails 3 app, here's my Gemfile: source 'http://rubygems.org' gem 'rails', '3.0.0' gem 'delayed_job' gem 'sqlite3-ruby', :require => 'sqlite3' Here's the class that represents the job that I want to queue: class Me < Struct.new(:something) def perform puts "Hello from me" logger.info "Hello from me" logger.debug "Hello from me" raise Exception.new end end From the console with no workers running: irb(main):002:0> Delayed::Job.enqueue Me.new(1) => #<Delayed::Backend::ActiveRecord::Job id: 7, priority: 0, attempts: 0, handler: "--- !ruby/struct:Me \nsomething: 1\n", last_error: nil

Manually Retry Job in Delayed_job

喜夏-厌秋 提交于 2019-11-29 19:25:13
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. 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::Job.find(10).destroy Beena Shetty Delayed::Worker.new.run(Delayed::Job.last) This will remove the job after it

Rails 4.2 get delayed job id from active job

混江龙づ霸主 提交于 2019-11-29 17:26:48
问题 Any idea how to get the Delayed::Job id from the ActiveJob enqueuing? When I enqueue a job I get back an instance of ActiveJob::Base with a @job_id , but that job id seems to be internal to ActiveJob. My best guess so far is just to walk down the most recently created jobs: active_job_id = GenerateReportJob.perform_later(self.id).job_id delayed_job = Delayed::Job.order(id: :desc).limit(5).detect do |job| YAML.load(job.handler).job_data['job_id'] == active_job_id end but that seems all kinds

How to ignore Delayed Job query logging in development on Rails

廉价感情. 提交于 2019-11-29 11:54:29
问题 How would I silence/ignore these Delayed Job query logs from log/development.log? Delayed::Backend::ActiveRecord::Job Load (1.0ms) UPDATE "delayed_jobs" SET locked_at = '2013-11-19 19:55:45.053991', locked_by = 'host:desktop-virtual pid:22277' WHERE id IN (SELECT id FROM "delayed_jobs" WHERE ((run_at <= '2013-11-19 19:55:45.053435' AND (locked_at IS NULL OR locked_at < '2013-11-19 15:55:45.053519') OR locked_by = 'host:desktop-virtual pid:22277') AND failed_at IS NULL) ORDER BY priority ASC,

Run Delayed Jobs and Sidekiq at the same time

a 夏天 提交于 2019-11-29 11:52:09
问题 I currently use delayed job to process jobs asynchronously. Instead of creating workers, I use the .delay method a lot. I want to move to Sidekiq, but I have too many types of jobs, and can't make sure all of them are thread safe. So I want to run Delayed Job and Sidekiq in parallel, and migrating one type of job at a time. Since both Delayed Job and Sidekiq offers the .delay method, how can I make the distinction between the two? Are there any other potential issues? 回答1: For Sidekiq 2.17.1

Node.js Kue how to restart failed jobs

若如初见. 提交于 2019-11-29 07:07:50
问题 I am using kue for delayed jobs in my node.js application. I have some problems to figure out how I can restart a job using the API of kue without having to move the id of a job manually from the the list of failed jobs to the list of inactive jobs using redis commands. Is this possible using kue? I don't want to set a fixed number of retry attempts - I just want to retry specific jobs. Suggestions for a well maintained alternative to kue are also welcome. 回答1: i dont know if this is working

Delayed_job not executing the perform method but emptying the job queue

浪子不回头ぞ 提交于 2019-11-29 06:14:49
问题 I have a fresh rails 3 app, here's my Gemfile: source 'http://rubygems.org' gem 'rails', '3.0.0' gem 'delayed_job' gem 'sqlite3-ruby', :require => 'sqlite3' Here's the class that represents the job that I want to queue: class Me < Struct.new(:something) def perform puts "Hello from me" logger.info "Hello from me" logger.debug "Hello from me" raise Exception.new end end From the console with no workers running: irb(main):002:0> Delayed::Job.enqueue Me.new(1) => #<Delayed::Backend::ActiveRecord

Start or ensure that Delayed Job runs when an application/server restarts

拟墨画扇 提交于 2019-11-29 00:52:09
问题 We have to use delayed_job (or some other background-job processor) to run jobs in the background, but we're not allowed to change the boot scripts/boot-levels on the server. This means that the daemon is not guaranteed to remain available if the provider restarts the server (since the daemon would have been started by a capistrano recipe that is only run once per deployment). Currently, the best way I can think of to ensure the delayed_job daemon is always running, is to add an initializer

Delayed job: How to reload the payload classes during every call in Development mode

不打扰是莪最后的温柔 提交于 2019-11-29 00:42:35
问题 I am running a delayed job worker. When ever I invoke the foo method, worker prints hello . class User def foo puts "Hello" end handle_asynchronously :foo end If I make some changes to the foo method, I have to restart the worker for the changes to reflect. In the development mode this can become quite tiresome. I am trying to find a way to reload the payload class(in this case User class) for every request. I tried monkey patching the DelayedJob library to invoke require_dependency before