Skip to content

Commit

Permalink
Merge pull request #428 from mitio/wait-for-confirms-raise-on-closed-…
Browse files Browse the repository at this point in the history
…channel

Raise when calling wait_for_confirms on a closed channel
  • Loading branch information
michaelklishin authored Jul 18, 2016
2 parents 8f2c0fd + 1b8601f commit c0c1b0b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/bunny/channel.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1783,6 +1783,8 @@ def wait_on_basic_get_continuations

# @private
def wait_on_confirms_continuations
raise_if_no_longer_open!

if @connection.threaded
t = Thread.current
@threads_waiting_on_confirms_continuations << t
Expand Down
12 changes: 12 additions & 0 deletions spec/higher_level_api/integration/publisher_confirms_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,18 @@
}.not_to raise_error

end

it "raises an error when called on a closed channel" do
ch = connection.create_channel

ch.confirm_select

ch.close

expect {
ch.wait_for_confirms
}.to raise_error(Bunny::ChannelAlreadyClosed)
end
end

context "when some of the messages get nacked" do
Expand Down

0 comments on commit c0c1b0b

Please sign in to comment.