bitly/go-notify — pull request #1 by rafrombrc (2012-11-22 02:13:52+00:00)
Title: Add `PostTimeout` function

This small patch adds a `PostTimeout` function that lets us tell go-notify to time out after a specific time.Duration for output channels that are blocking. I found this was necessary for testing environments, b/c multiple tests might exercise code which registers an event listener channel, but only one of the channels would actually be in use for a given test. The first test that causes an event listener to be registered would work just fine. The second test that does so, however, would hang, because the first event listener is still registered, but the code on the other side that pulls the event off of the channel wasn't being called by the other test.

Another possible solution would be to allow some bad touch into go-notify, so that the test structure could actually remove events even when they don't have a handle on the channel that is listening, maybe using a `StopAll` function for a particular event, for instance. Let me know if you'd rather I take that approach.