Skip to content

Commit

Permalink
Don't reject unknown types.
Browse files Browse the repository at this point in the history
Sneakers retries rejects, when really we just don't want to do anything.
  • Loading branch information
tpendragon committed Mar 5, 2018
1 parent a652e0c commit 5aff44d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
8 changes: 2 additions & 6 deletions app/workers/plum_event_handler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,7 @@ class PlumEventHandler

def work(msg)
msg = JSON.parse(msg)
result = PlumEventProcessor.new(msg).process
if result
ack!
else
reject!
end
PlumEventProcessor.new(msg).process
ack!
end
end
4 changes: 2 additions & 2 deletions spec/workers/plum_event_handler_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@
expect(PlumEventProcessor).to have_received(:new).with(msg)
expect(handler).to have_received(:ack!)
end
it "rejects the message if the processing fails" do
it "acknowleges the message if the event is unknown" do
plum_event_processor = instance_double(PlumEventProcessor, process: false)
allow(PlumEventProcessor).to receive(:new).and_return(plum_event_processor)

handler.work(msg.to_json)

expect(plum_event_processor).to have_received(:process)
expect(PlumEventProcessor).to have_received(:new).with(msg)
expect(handler).to have_received(:reject!)
expect(handler).to have_received(:ack!)
end
end
end

0 comments on commit 5aff44d

Please sign in to comment.