Skip to content

Commit d01101e

Browse files
Document run-cycle backoff reset intent and reduce test flake
Co-authored-by: brendandburns <5751682+brendandburns@users.noreply.github.com>
1 parent 91ebbd6 commit d01101e

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

util/src/main/java/io/kubernetes/client/informer/cache/ReflectorRunnable.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ public ReflectorRunnable(
113113
*/
114114
public void run() {
115115
log.info("{}#Start listing and watching...", apiTypeClass);
116+
// run() can be invoked multiple times for the same reflector instance; always restart backoff
117+
// from the initial value for each list-watch cycle.
116118
resetWatchRetryBackoff();
117119

118120
try {

util/src/test/java/io/kubernetes/client/informer/cache/ReflectorRunnableTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ void reflectorWatchConnectExceptionShouldUseExponentialBackoff()
387387
Thread thread = new Thread(reflectorRunnable::run);
388388
thread.setDaemon(true);
389389
thread.start();
390-
assertThat(latch.await(2, TimeUnit.SECONDS)).isTrue();
390+
assertThat(latch.await(5, TimeUnit.SECONDS)).isTrue();
391391
} finally {
392392
reflectorRunnable.stop();
393393
}

0 commit comments

Comments
 (0)