From da100c6170f14f30ca6099fece6e47b39ef81530 Mon Sep 17 00:00:00 2001 From: Brian Picciano Date: Sun, 13 Nov 2022 16:49:23 +0100 Subject: [PATCH] Fix garage Wait method not sleeping properly between tries --- entrypoint/src/garage/admin_client.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/entrypoint/src/garage/admin_client.go b/entrypoint/src/garage/admin_client.go index 7dfd43e..2c03703 100644 --- a/entrypoint/src/garage/admin_client.go +++ b/entrypoint/src/garage/admin_client.go @@ -130,7 +130,12 @@ func (c *AdminClient) Do( // ReplicationFactor-1 other garage instances. If the context is canceled it // will return the context error. func (c *AdminClient) Wait(ctx context.Context) error { - for { + + for first := true; ; first = false { + + if !first { + time.Sleep(250 * time.Millisecond) + } var clusterStatus struct { KnownNodes map[string]struct { @@ -159,6 +164,5 @@ func (c *AdminClient) Wait(ctx context.Context) error { return nil } - time.Sleep(250 * time.Millisecond) } }