in grpcgcp/multiendpoint/multiendpoint.go [228:247]
func (me *multiEndpoint) switchFromTo(f, t *endpoint) {
if me.current == t.id {
return
}
if me.switchingDelay == 0 || f == nil || f.status == unavailable {
// Switching immediately if no delay or no current or current is unavailable.
me.current = t.id
return
}
me.future = t.id
timeAfterFunc(me.switchingDelay, func() {
me.Lock()
defer me.Unlock()
if e, ok := me.endpoints[me.future]; ok && e.status == available {
me.current = e.id
}
})
}