mirror of
https://github.com/kubernetes/client-go.git
synced 2026-02-21 15:43:05 +00:00
This commit refactors the `renew` function in the leader election package to replace the deprecated `wait.PollImmediateUntil` with `wait.PollUntilContextTimeout`. This change simplifies the context handling by removing the need for an additional timeout context and its cancellation. The previous implementation created a timeout context for each retry period, which added unnecessary complexity. The new implementation directly passes the parent context to the retry function, ensuring that the timeout is handled within `PollUntilContextTimeout`. This change also ensures that the context passed to `tryAcquireOrRenew` and `tryCoordinatedRenew` is consistent, improving the readability and maintainability of the code. Kubernetes-commit: 3d2f498aa31cb2e90bcfc372b7930aed0604fbef