Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce pod status polling frequency #18144

Merged
merged 2 commits into from
Oct 19, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,11 @@ public boolean waitFor(final long timeout, final TimeUnit unit) throws Interrupt

final long deadline = System.nanoTime() + remainingNanos;
do {
Thread.sleep(Math.min(TimeUnit.NANOSECONDS.toMillis(remainingNanos) + 1, 100));
// The remainingNanos bit is about calculating how much time left for the actual timeout.
// Most of the time we should be sleeping for 500ms except when we get to the actual timeout.
// We are waiting polling every 500ms for status. The trade-off here is between how often
// we poll our status storage (GCS) and how reactive we are to detect that a process is done.
Thread.sleep(Math.min(TimeUnit.NANOSECONDS.toMillis(remainingNanos) + 1, 500));
if (hasExited())
return true;
remainingNanos = deadline - System.nanoTime();
Expand Down