alphagov/content-store — pull request #66 by alext (2014-10-17 13:15:21+00:00)
Title: Reset rabbitmq channel on errors.

The publisher confirm feature we're using allow sending one or more
messages to rabbitmq, and then requesting confirms for all of them.
This requires Bunny to keep track of how many confirms are outstanding.
If an error occurs when sending a message, this count can get out of
sync with the server, resulting in Bunny attempting to wait for more
confirms than will ever be sent, which in turn leads to timeout errors.

The outstanding message count is a per-channel thing, so by closing the
channel, and creating a new one, this problem is avoided, and subsequent
message sending works.