knuu
knuu copied to clipboard
Do busy waiting in replacement with a timeout
- https://github.com/celestiaorg/knuu/blob/62170e970a1da935458910d8c9e74b5cd390e15e/pkg/k8s/k8s_statefulset.go#L74
- https://github.com/celestiaorg/knuu/blob/62170e970a1da935458910d8c9e74b5cd390e15e/pkg/k8s/k8s_pod.go#L104
- check for other places in the code
timeout := 5 * time.Second // Set the timeout duration start := time.Now() // Record the start time
for { _, err := getPod(podConfig.Namespace, podConfig.Name) if err != nil { break }
if time.Since(start) >= timeout {
// Timeout exceeded, handle the timeout condition
// For example, you can log an error or return an appropriate response.
break
}
time.Sleep(100 * time.Millisecond)
}
something like this?