(ctx *context, slots ...*models.SlotMapping)
| 145 | } |
| 146 | |
| 147 | func (s *Topom) resyncSlotMappings(ctx *context, slots ...*models.SlotMapping) error { |
| 148 | if len(slots) == 0 { |
| 149 | return nil |
| 150 | } |
| 151 | var fut sync2.Future |
| 152 | for _, p := range ctx.proxy { |
| 153 | fut.Add() |
| 154 | go func(p *models.Proxy) { |
| 155 | err := s.newProxyClient(p).FillSlots(ctx.toSlotSlice(slots, p)...) |
| 156 | if err != nil { |
| 157 | log.ErrorErrorf(err, "proxy-[%s] resync slots failed", p.Token) |
| 158 | } |
| 159 | fut.Done(p.Token, err) |
| 160 | }(p) |
| 161 | } |
| 162 | for t, v := range fut.Wait() { |
| 163 | switch err := v.(type) { |
| 164 | case error: |
| 165 | if err != nil { |
| 166 | return errors.Errorf("proxy-[%s] resync slots failed", t) |
| 167 | } |
| 168 | } |
| 169 | } |
| 170 | return nil |
| 171 | } |
no test coverage detected