josevalim/xgen — pull request #6 by fishcakez (2014-04-06 22:14:39+00:00)
Title: Fix GenEvent stream errors and leaking messages

Previously the GenEvent stream was too defensive on its error handling and would hide when a GenEvent manager exited or the event handler was swapped.

Previously messages could leak from a GenEvent stream because it did not wait for the forwarding of events to stop before flushing its message queue.

Please see the test changes for how behaviour is different.

Note that messages may leak if the `after_fun` raises. It is pointless trying to flush in this case because there is no guarantee messages won't arrive after flushing.