Skip to content

Commit

Permalink
optimize spiderpool-init restart spiderpool-agent codes
Browse files Browse the repository at this point in the history
Signed-off-by: Icarus9913 <[email protected]>
  • Loading branch information
Icarus9913 committed Jan 23, 2024
1 parent 4e170c0 commit 2c732da
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion cmd/spiderpool-init/cmd/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,13 +187,16 @@ func (c *CoreClient) WaitPodListReady(ctx context.Context, namespace string, lab
var podList corev1.PodList
var err error
noReady := true
interval := retryIntervalSec * time.Second
for noReady {
if err = c.List(ctx, &podList, client.MatchingLabels(labels), client.InNamespace(namespace)); err != nil {
logger.Sugar().Errorf("failed to get spiderAgent pods: %v, retrying...", err)
time.Sleep(interval)
continue
}

if podList.Items == nil {
time.Sleep(interval)
continue
}

Expand All @@ -209,7 +212,6 @@ func (c *CoreClient) WaitPodListReady(ctx context.Context, namespace string, lab
case <-ctx.Done():
return ctx.Err()
default:
interval := retryIntervalSec * time.Second
logger.Sugar().Info("spiderpool-agent not ready, waiting...")
time.Sleep(interval)
}
Expand Down

0 comments on commit 2c732da

Please sign in to comment.