hashicorp/consul — pull request #489 by ryanuber (2014-11-21 04:47:01+00:00)
Title: Preserve ordering of event buffer when filtering on name

Fixes a nasty bug in event watches. What happens is when multiple events with different names get fired in a non-sequential order, and we then filter on the event names, the order of the events gets mixed up by relocating the very last index to the middle of the event buffer slice. This can cause the event index to be returned incorrectly since we just take the very last matching event in the event buffer and compare its index with the watch request, which ultimately leads to event handlers not being fired when they should be.

Fixes #479