simplify AcknowledgeUpdates
@@ -136,8 +136,7 @@ func DefaultHandler(eh Handler) Option {
// AcknowledgeUpdates generates a Handler that sends an Acknowledge call to Mesos for every
// UPDATE event that's received.
func AcknowledgeUpdates(callerGetter func() calls.Caller) Handler {
- return HandlerFunc(func(e *scheduler.Event) (err error) {
- if e.GetType() == scheduler.Event_UPDATE {
+ return WhenFunc(scheduler.Event_UPDATE, func(e *scheduler.Event) (err error) {
var (
s = e.GetUpdate().GetStatus()
uuid = s.GetUUID()
@@ -150,7 +149,6 @@ func AcknowledgeUpdates(callerGetter func() calls.Caller) Handler {
)
err = calls.CallNoData(callerGetter(), ack)
}
- }
return
})
}
