Skip to content

Commit

Permalink
Configure Airbrak to ignore PG::TRDeadlockDetected errors when trigge…
Browse files Browse the repository at this point in the history
…red from a job. #136
  • Loading branch information
dwilkie committed Jun 6, 2015
1 parent bb453fe commit 5e26cb6
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
9 changes: 8 additions & 1 deletion config/initializers/airbrake.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,15 @@
config.port = 443
config.secure = config.port == 443

# this will be retried succesfully
config.ignore_by_filter do |exception_data|
exception_data["error_class"] == "AASM::InvalidTransition" &&
exception_data["class"] == "DeliveryReceiptUpdateStatusJob"
(exception_data["parameters"] || {})["class"] == "DeliveryReceiptUpdateStatusJob"
end

# this will be retried succesfully
config.ignore_by_filter do |exception_data|
exception_data["error_class"] == "PG::TRDeadlockDetected" &&
(exception_data["parameters"] || {})["class"] == "ActiveJob::QueueAdapters::SidekiqAdapter::JobWrapper"
end
end
15 changes: 14 additions & 1 deletion spec/models/msisdn_discovery_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,15 @@
describe "#notify" do
let(:msisdn) { subject.msisdn }

before do
def setup_scenario
reply
subject.reload
end

before do
setup_scenario
end

subject { create(:msisdn_discovery, state) }
let(:reply) { create(:reply, reply_state, :msisdn_discovery => subject) }

Expand Down Expand Up @@ -132,6 +136,15 @@
let(:state) { :awaiting_result }
it { is_expected.to be_inactive }
it { expect(msisdn).not_to be_active }

context "this state is queued_for_discovery" do
let(:state) { :queued_for_discovery }

def setup_scenario
end

it { expect { reply }.to raise_error(AASM::InvalidTransition) }
end
end

context "expired" do
Expand Down

0 comments on commit 5e26cb6

Please sign in to comment.