mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Merge pull request #10283 from mkllnk/application-job
Add Rails standard ApplicationJob for consistency
This commit is contained in:
@@ -684,19 +684,6 @@ Rails/ApplicationController:
|
||||
Exclude:
|
||||
- 'engines/dfc_provider/app/controllers/dfc_provider/base_controller.rb'
|
||||
|
||||
# Offense count: 6
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
Rails/ApplicationJob:
|
||||
Exclude:
|
||||
- 'app/jobs/bulk_invoice_job.rb'
|
||||
- 'app/jobs/heartbeat_job.rb'
|
||||
- 'app/jobs/order_cycle_closing_job.rb'
|
||||
- 'app/jobs/order_cycle_notification_job.rb'
|
||||
- 'app/jobs/report_job.rb'
|
||||
- 'app/jobs/subscription_confirm_job.rb'
|
||||
- 'app/jobs/subscription_placement_job.rb'
|
||||
- 'spec/services/job_processor_spec.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
Rails/ApplicationMailer:
|
||||
|
||||
10
app/jobs/application_job.rb
Normal file
10
app/jobs/application_job.rb
Normal file
@@ -0,0 +1,10 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# Rails standard class for common job code.
|
||||
class ApplicationJob < ActiveJob::Base
|
||||
# Automatically retry jobs that encountered a deadlock
|
||||
# retry_on ActiveRecord::Deadlocked
|
||||
|
||||
# Most jobs are safe to ignore if the underlying records are no longer available
|
||||
# discard_on ActiveJob::DeserializationError
|
||||
end
|
||||
@@ -1,6 +1,6 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class BulkInvoiceJob < ActiveJob::Base
|
||||
class BulkInvoiceJob < ApplicationJob
|
||||
def perform(order_ids, filepath)
|
||||
pdf = CombinePDF.new
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class HeartbeatJob < ActiveJob::Base
|
||||
class HeartbeatJob < ApplicationJob
|
||||
def perform
|
||||
Spree::Config.last_job_queue_heartbeat_at = Time.now.in_time_zone
|
||||
end
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class OrderCycleClosingJob < ActiveJob::Base
|
||||
class OrderCycleClosingJob < ApplicationJob
|
||||
def perform
|
||||
return if recently_closed_order_cycles.empty?
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# Delivers an email with a report of the order cycle to each of its suppliers
|
||||
class OrderCycleNotificationJob < ActiveJob::Base
|
||||
class OrderCycleNotificationJob < ApplicationJob
|
||||
def perform(order_cycle_id)
|
||||
order_cycle = OrderCycle.find(order_cycle_id)
|
||||
order_cycle.suppliers.each do |supplier|
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
require 'order_management/subscriptions/summarizer'
|
||||
|
||||
# Confirms orders of unconfirmed proxy orders in recently closed Order Cycles
|
||||
class SubscriptionConfirmJob < ActiveJob::Base
|
||||
class SubscriptionConfirmJob < ApplicationJob
|
||||
def perform
|
||||
confirm_proxy_orders!
|
||||
end
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'order_management/subscriptions/summarizer'
|
||||
|
||||
class SubscriptionPlacementJob < ActiveJob::Base
|
||||
class SubscriptionPlacementJob < ApplicationJob
|
||||
def perform
|
||||
proxy_orders.each do |proxy_order|
|
||||
place_order_for(proxy_order)
|
||||
|
||||
@@ -8,7 +8,7 @@ MiniRacer::Platform.set_flags!(:single_threaded)
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
class TestJob < ActiveJob::Base
|
||||
class TestJob < ApplicationJob
|
||||
def initialize
|
||||
@file = Tempfile.new("test-job-result")
|
||||
super
|
||||
|
||||
Reference in New Issue
Block a user