Prioritizing Recent Messages with Go Channels

I was writing a controller that watches Kubernetes HPAs and Istio VirtualServices for changes and coordinates between the two. Both watchers feed updates into the same reconciliation loop, and the loop needs to act on whatever the current state is, not replay a backlog of intermediate states it missed while it was busy reconciling. I had the watchers sending over Go channels and the reconciler was…