diff --git a/app/jobs/fees/create_pay_in_advance_job.rb b/app/jobs/fees/create_pay_in_advance_job.rb index 6c7fba33ba1..3424c2380a7 100644 --- a/app/jobs/fees/create_pay_in_advance_job.rb +++ b/app/jobs/fees/create_pay_in_advance_job.rb @@ -4,6 +4,8 @@ module Fees class CreatePayInAdvanceJob < ApplicationJob queue_as :default + unique :until_executed, on_conflict: :log + def perform(charge:, event:, billing_at: nil) result = Fees::CreatePayInAdvanceService.call(charge:, event:, billing_at:) diff --git a/app/jobs/integrations/aggregator/credit_notes/create_job.rb b/app/jobs/integrations/aggregator/credit_notes/create_job.rb index eb0bd189660..f575bec8c08 100644 --- a/app/jobs/integrations/aggregator/credit_notes/create_job.rb +++ b/app/jobs/integrations/aggregator/credit_notes/create_job.rb @@ -6,6 +6,8 @@ module CreditNotes class CreateJob < ApplicationJob queue_as 'integrations' + unique :until_executed, on_conflict: :log + retry_on LagoHttpClient::HttpError, wait: :polynomially_longer, attempts: 3 retry_on RequestLimitError, wait: :polynomially_longer, attempts: 100 diff --git a/app/jobs/integrations/aggregator/invoices/create_job.rb b/app/jobs/integrations/aggregator/invoices/create_job.rb index 75218dd026a..6d2c00604d0 100644 --- a/app/jobs/integrations/aggregator/invoices/create_job.rb +++ b/app/jobs/integrations/aggregator/invoices/create_job.rb @@ -6,6 +6,8 @@ module Invoices class CreateJob < ApplicationJob queue_as 'integrations' + unique :until_executed, on_conflict: :log + retry_on LagoHttpClient::HttpError, wait: :polynomially_longer, attempts: 3 retry_on RequestLimitError, wait: :polynomially_longer, attempts: 100 diff --git a/app/jobs/integrations/aggregator/invoices/crm/create_customer_association_job.rb b/app/jobs/integrations/aggregator/invoices/crm/create_customer_association_job.rb index dbf980328b5..938748eec1d 100644 --- a/app/jobs/integrations/aggregator/invoices/crm/create_customer_association_job.rb +++ b/app/jobs/integrations/aggregator/invoices/crm/create_customer_association_job.rb @@ -7,6 +7,8 @@ module Crm class CreateCustomerAssociationJob < ApplicationJob queue_as 'integrations' + unique :until_executed, on_conflict: :log + retry_on LagoHttpClient::HttpError, wait: :polynomially_longer, attempts: 10 retry_on RequestLimitError, wait: :polynomially_longer, attempts: 100 diff --git a/app/jobs/integrations/aggregator/invoices/crm/create_job.rb b/app/jobs/integrations/aggregator/invoices/crm/create_job.rb index 44155e8a363..85770a419a4 100644 --- a/app/jobs/integrations/aggregator/invoices/crm/create_job.rb +++ b/app/jobs/integrations/aggregator/invoices/crm/create_job.rb @@ -7,6 +7,8 @@ module Crm class CreateJob < ApplicationJob queue_as 'integrations' + unique :until_executed, on_conflict: :log + retry_on LagoHttpClient::HttpError, wait: :polynomially_longer, attempts: 10 retry_on Integrations::Aggregator::BasePayload::Failure, wait: :polynomially_longer, attempts: 10 retry_on RequestLimitError, wait: :polynomially_longer, attempts: 100 diff --git a/app/jobs/integrations/aggregator/invoices/crm/update_job.rb b/app/jobs/integrations/aggregator/invoices/crm/update_job.rb index 45418dd6eea..288a1494a56 100644 --- a/app/jobs/integrations/aggregator/invoices/crm/update_job.rb +++ b/app/jobs/integrations/aggregator/invoices/crm/update_job.rb @@ -7,6 +7,8 @@ module Crm class UpdateJob < ApplicationJob queue_as 'integrations' + unique :until_executed, on_conflict: :log + retry_on LagoHttpClient::HttpError, wait: :polynomially_longer, attempts: 10 retry_on Integrations::Aggregator::BasePayload::Failure, wait: :polynomially_longer, attempts: 10 retry_on RequestLimitError, wait: :polynomially_longer, attempts: 100 diff --git a/app/jobs/integrations/aggregator/payments/create_job.rb b/app/jobs/integrations/aggregator/payments/create_job.rb index dafba9a2c11..7bb27404fa1 100644 --- a/app/jobs/integrations/aggregator/payments/create_job.rb +++ b/app/jobs/integrations/aggregator/payments/create_job.rb @@ -6,6 +6,8 @@ module Payments class CreateJob < ApplicationJob queue_as 'integrations' + unique :until_executed, on_conflict: :log + retry_on LagoHttpClient::HttpError, wait: :polynomially_longer, attempts: 5 retry_on Integrations::Aggregator::BasePayload::Failure, wait: :polynomially_longer, attempts: 10 retry_on RequestLimitError, wait: :polynomially_longer, attempts: 100 diff --git a/app/jobs/integrations/aggregator/subscriptions/crm/create_customer_association_job.rb b/app/jobs/integrations/aggregator/subscriptions/crm/create_customer_association_job.rb index cfc36a76771..93ec015ceff 100644 --- a/app/jobs/integrations/aggregator/subscriptions/crm/create_customer_association_job.rb +++ b/app/jobs/integrations/aggregator/subscriptions/crm/create_customer_association_job.rb @@ -7,6 +7,8 @@ module Crm class CreateCustomerAssociationJob < ApplicationJob queue_as 'integrations' + unique :until_executed, on_conflict: :log + retry_on LagoHttpClient::HttpError, wait: :polynomially_longer, attempts: 10 retry_on RequestLimitError, wait: :polynomially_longer, attempts: 100 diff --git a/app/jobs/integrations/aggregator/subscriptions/crm/create_job.rb b/app/jobs/integrations/aggregator/subscriptions/crm/create_job.rb index 0a2cf9ce63e..dec20f5e496 100644 --- a/app/jobs/integrations/aggregator/subscriptions/crm/create_job.rb +++ b/app/jobs/integrations/aggregator/subscriptions/crm/create_job.rb @@ -7,6 +7,8 @@ module Crm class CreateJob < ApplicationJob queue_as 'integrations' + unique :until_executed, on_conflict: :log + retry_on LagoHttpClient::HttpError, wait: :polynomially_longer, attempts: 10 retry_on Integrations::Aggregator::BasePayload::Failure, wait: :polynomially_longer, attempts: 10 retry_on RequestLimitError, wait: :polynomially_longer, attempts: 100 diff --git a/app/jobs/integrations/aggregator/subscriptions/crm/update_job.rb b/app/jobs/integrations/aggregator/subscriptions/crm/update_job.rb index 8860fd0d9e8..347e3361c31 100644 --- a/app/jobs/integrations/aggregator/subscriptions/crm/update_job.rb +++ b/app/jobs/integrations/aggregator/subscriptions/crm/update_job.rb @@ -7,6 +7,8 @@ module Crm class UpdateJob < ApplicationJob queue_as 'integrations' + unique :until_executed, on_conflict: :log + retry_on LagoHttpClient::HttpError, wait: :polynomially_longer, attempts: 10 retry_on Integrations::Aggregator::BasePayload::Failure, wait: :polynomially_longer, attempts: 10 retry_on RequestLimitError, wait: :polynomially_longer, attempts: 100 diff --git a/app/jobs/invoices/create_pay_in_advance_charge_job.rb b/app/jobs/invoices/create_pay_in_advance_charge_job.rb index 83971caf51b..0b8af74a670 100644 --- a/app/jobs/invoices/create_pay_in_advance_charge_job.rb +++ b/app/jobs/invoices/create_pay_in_advance_charge_job.rb @@ -6,6 +6,8 @@ class CreatePayInAdvanceChargeJob < ApplicationJob retry_on Sequenced::SequenceError + unique :until_executed, on_conflict: :log + def perform(charge:, event:, timestamp:, invoice: nil) result = Invoices::CreatePayInAdvanceChargeService.call(charge:, event:, timestamp:, invoice:) return if result.success?