MCPcopy Index your code
hub / github.com/koding/kite / WaitTillConnected

Function WaitTillConnected

kontrol/helper_test.go:282–314  ·  view source on GitHub ↗
(conf *Config, timeout time.Duration, hks ...*HelloKite)

Source from the content-addressed store, hash-verified

280}
281
282func WaitTillConnected(conf *Config, timeout time.Duration, hks ...*HelloKite) error {
283 k := kite.New("WaitTillConnected", "1.0.0")
284 k.Config = conf.Config.Copy()
285
286 t := time.After(timeout)
287
288 for {
289 select {
290 case <-t:
291 return fmt.Errorf("timed out waiting for %v after %s", hks, timeout)
292 default:
293 kites, err := k.GetKites(&protocol.KontrolQuery{
294 Version: "1.0.0",
295 })
296 if err != nil && err != kite.ErrNoKitesAvailable {
297 return err
298 }
299
300 notReady := make(map[string]struct{}, len(hks))
301 for _, hk := range hks {
302 notReady[hk.Kite.Kite().ID] = struct{}{}
303 }
304
305 for _, kite := range kites {
306 delete(notReady, kite.Kite.ID)
307 }
308
309 if len(notReady) == 0 {
310 return nil
311 }
312 }
313 }
314}
315
316func pause(args ...interface{}) {
317 if testing.Verbose() && interactive {

Callers 1

TestUpdateKeysFunction · 0.85

Calls 3

CopyMethod · 0.80
GetKitesMethod · 0.80
KiteMethod · 0.45

Tested by

no test coverage detected