mitsuhiko/logbook — pull request #124 by k4nar (2014-10-11 09:51:07+00:00)
Title: Close the socket with linger=0 at the end of a ZeroMQHandler

Without this change, a ZeroMQHandler no able to reach the subscriber will hang indefinitely when deleted. This is due to the `linger` option of socket.close which default to -1, meaning that the socket will wait for all data to be sent before closing.

However, this change might imply some lost messages, as if some messages are lingering when the handler is deleted they will never be sent. We can add an heuristic rather that `linger=0`, like `linger=0.1` which will wait 100ms before closing the socket. But we'll never be sure that everything has been sent as we don't know if the Subscriber is up anyway.