QubitProducts/bamboo — pull request #42 by sttts (2014-10-19 09:29:59+00:00)
Title: Combine sequential update events

We move the haproxy update and reload logic into a go routine which listens for
update requests on updateChan. If an update is already queued, the channel is
drained and another update request is sent. This way there can only be one
pending update queued. At the same time, no update can be missed.

By moving the real haproxy reload work into a go routine, the actual HTTP
handler remains fast and slim. Before this patch in real world environements it
took over 2 seconds to return. Marathon sometimes sends a lot of events
sequentially, leading to HTTP POST timeouts on Marathon's side if the HTTP
handler takes so long. This patch will fix this and at the same time reduce the
number of reloads to a minimum.