Skip to content

Commit

Permalink
Merge pull request spidernet-io#3123 from Icarus9913/fix/wk/init
Browse files Browse the repository at this point in the history
optimize spiderpool-init restart spiderpool-agent codes
  • Loading branch information
cyclinder committed Jan 23, 2024
2 parents 4e170c0 + 2c732da commit e2085e4
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 e2085e4

Please sign in to comment.