Fix garage Wait method not sleeping properly between tries

This commit is contained in:
Brian Picciano 2022-11-13 16:49:23 +01:00
parent 629a8ec9b2
commit da100c6170

View File

@ -130,7 +130,12 @@ func (c *AdminClient) Do(
// ReplicationFactor-1 other garage instances. If the context is canceled it // ReplicationFactor-1 other garage instances. If the context is canceled it
// will return the context error. // will return the context error.
func (c *AdminClient) Wait(ctx context.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 { var clusterStatus struct {
KnownNodes map[string]struct { KnownNodes map[string]struct {
@ -159,6 +164,5 @@ func (c *AdminClient) Wait(ctx context.Context) error {
return nil return nil
} }
time.Sleep(250 * time.Millisecond)
} }
} }