Class: EnterQuoteRoomsWorker
- Inherits:
-
Object
- Object
- EnterQuoteRoomsWorker
- Includes:
- Sidekiq::Job, Workers::StatusBroadcastable
- Defined in:
- app/workers/enter_quote_rooms_worker.rb
Overview
Sidekiq worker: enter quote rooms.
Constant Summary collapse
- DB_RETRY_EXCEPTIONS =
Exceptions that trigger retries in db.
[ActiveRecord::ConnectionNotEstablished, PG::ConnectionBad].freeze
Instance Attribute Summary
Attributes included from Workers::StatusBroadcastable
Instance Method Summary collapse
Methods included from Workers::StatusBroadcastable::Overrides
Instance Method Details
#perform(options = {}) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/workers/enter_quote_rooms_worker.rb', line 13 def perform( = {}) quote_id = [:quote_id] redirect_path = [:redirect_path] || "/quotes/#{quote_id}?tab=rooms" Retryable.retryable(tries: 3, sleep: ->(n) { 0.5 * (2**n) }, on: DB_RETRY_EXCEPTIONS) do |attempt_number, exception| Rails.logger.warn("EnterQuoteRoomsWorker connection retry #{attempt_number}: #{exception.class}") if attempt_number > 1 perform_with_lock(, redirect_path) end rescue StandardError => e store message: "Error updating rooms: #{e.}" store error_message: "Failed to update room configurations: #{e.}" store redirect_to: redirect_path Rails.logger.error("EnterQuoteRoomsWorker error for quote #{quote_id}: #{e.}\n#{e.backtrace.join("\n")}") raise # AppSignal catches this automatically end |