Class: EnterQuoteRoomsWorker
Constant Summary
collapse
- DB_RETRY_EXCEPTIONS =
[ActiveRecord::ConnectionNotEstablished, PG::ConnectionBad].freeze
Instance Attribute Summary
#broadcast_status_updates
Instance Method Summary
collapse
#at, #store, #total
Instance Method Details
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'app/workers/enter_quote_rooms_worker.rb', line 11
def perform(options = {})
options = options.with_indifferent_access
quote_id = options[:quote_id]
redirect_path = options[: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(options, redirect_path)
end
rescue StandardError => e
store message: "Error updating rooms: #{e.message}"
store error_message: "Failed to update room configurations: #{e.message}"
store redirect_to: redirect_path
Rails.logger.error("EnterQuoteRoomsWorker error for quote #{quote_id}: #{e.message}\n#{e.backtrace.join("\n")}")
raise end
|