rails-activejob

Disable automatic retry with ActiveJob, used with Sidekiq

痴心易碎 提交于 2020-07-17 03:29:14
问题 Is there a way to disable automatic retry with ActiveJob and Sidekiq ? I know that with Sidekiq only, we just have to put sidekiq_options :retry => false as mentioned here : https://github.com/mperham/sidekiq/wiki/Error-Handling#configuration but it doesn't seem to work with ActiveJob and Sidekiq. I also know the solution to entierly disable the retry as proposed here : https://stackoverflow.com/a/28216822/2431728 But it's not the behavior I need. 回答1: Ok thanks for the answer. Just for

Disable automatic retry with ActiveJob, used with Sidekiq

只谈情不闲聊 提交于 2020-07-17 03:28:44
问题 Is there a way to disable automatic retry with ActiveJob and Sidekiq ? I know that with Sidekiq only, we just have to put sidekiq_options :retry => false as mentioned here : https://github.com/mperham/sidekiq/wiki/Error-Handling#configuration but it doesn't seem to work with ActiveJob and Sidekiq. I also know the solution to entierly disable the retry as proposed here : https://stackoverflow.com/a/28216822/2431728 But it's not the behavior I need. 回答1: Ok thanks for the answer. Just for

How to properly test ActiveJob's retry_on method with rspec?

此生再无相见时 提交于 2020-05-14 14:57:29
问题 I have been attempting to test this method for the past few days with no luck. Another thing I'd like to be able to do is rescue the error that bubbles up after the final retry attempt is made. Please see my comments and code snippets below. Source code for retry_on is here as well for context. Here's the sample code and tests: my_job.rb retry_on Exception, wait: 2.hours, attempts: 3 do |job, exception| # some kind of rescue here after job.exceptions == 3 # then notify Bugsnag of failed final

redirect_url is missing in email instructions sent to the user for password reset

戏子无情 提交于 2020-01-15 23:57:10
问题 I am trying to build api urls for password reset via. devise_token_auth gem. As per the usage mentioned here, the POST request for /api/v1/auth/password needs params email and redirect_url . The user matching the email param will be sent instructions on how to reset their password. redirect_url is the url to which the user will be redirected after visiting the link contained in the email. However, I am getting the following URL in the email for password reset, in which the param redirect_url

Handle dependent destroy via active jobs

天大地大妈咪最大 提交于 2020-01-14 09:35:07
问题 I have a couple models with many children. Dependent destroy has gotten really heavy. Anyone know of a way to tie dependent destroy into active jobs? Or, is my only option to remove dependent destroy and role my own jobs via callbacks on the parent model? 回答1: You can create a worker to destroy the models async and enqueue it's deletion. Something like: class ComplexModelDeletion < ActiveJob::Base def perform(model) model.destroy! end end And the model could be something like: class Model <

Should you still pass only the object id when using ActiveJob?

谁都会走 提交于 2020-01-13 07:53:11
问题 What are the pros and cons of doing the following in ActiveJob: Option A: // Controller MyJob.perform_later(object.id) // my_job.rb def perform(object_id) object = Object.find(object_id) // do stuff end Option B: // Controller MyJob.perform_later(object) // my_job.rb def perform(object) // do stuff end 回答1: ActiveJob now uses the new Globalid library behind the scenes to serialize/deserialize an ActiveRecord instance, therefore you can now pass an ActiveRecord object. I personally prefer to

ActiveJob GlobalID and in-memory ActiveRecord objects

两盒软妹~` 提交于 2020-01-06 16:19:12
问题 I'm using a queuing system (Sidekiq) and want to move to ActiveJob to gain a performance benefit of not having to query the database every time I pass an ActiveRecord object to a worker. I wanted to ask and confirm since I wasn't 100% sure but my understanding is that when ActiveJob is using the GlobalID to pass ActiveRecord objects that is all done in memory and a separate query to the database is not done, correct? 回答1: That is not correct. If you use ActiveJob it will serialize any

I get a “Pending Error” whenever I click on Pay using Payola-Payment Gem (A gem made for Stripe) in my Rails 4.2.1 application

有些话、适合烂在心里 提交于 2020-01-06 03:10:08
问题 Using Payola-Payments Gem to handle Stripe Payments, it's necessary to set Background Worker for your transaction. After setting up Background Worker using ActiveJob, I will get error when I click pay. Here is it : Note: Am using Windows Environment (Windows 8) and I believe there is something am doing wrong here. Error Alert Renders on my View: This seems to be taking too long. Please contact support and give them transaction ID: ook4dp Here is the generated code from Console Started POST "