We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent adce9cf commit 70c6fb2Copy full SHA for 70c6fb2
pkg/client.go
@@ -457,6 +457,25 @@ func (c *BlobCacheClient) HostsAvailable() bool {
457
return c.hostMap.Members().Cardinality() > 0
458
}
459
460
+func (c *BlobCacheClient) WaitForHosts(timeout time.Duration) error {
461
+ ctx, cancel := context.WithTimeout(context.Background(), timeout)
462
+ defer cancel()
463
+
464
+ Logger.Infof("Waiting for hosts to be available...")
465
+ for {
466
+ select {
467
+ case <-ctx.Done():
468
+ return ctx.Err()
469
+ default:
470
+ if c.HostsAvailable() {
471
+ return nil
472
+ }
473
474
+ time.Sleep(1 * time.Second)
475
476
477
+}
478
479
func (c *BlobCacheClient) GetState() error {
480
ctx, cancel := context.WithTimeout(c.ctx, getContentRequestTimeout)
481
defer cancel()
0 commit comments