Skip to content

Commit f716b38

Browse files
authored
Merge pull request #1611 from yue9944882/chore/rewatch-log-level
Chore: Reducing rewatch logging verbosity upon normal re-connection
2 parents 1dc12cb + 0e596bb commit f716b38

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

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

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -223,10 +223,15 @@ private void watchHandler(Watchable<ApiType> watch) {
223223
continue;
224224
}
225225
if (eventType.get() == EventType.ERROR) {
226-
String errorMessage =
227-
String.format("got ERROR event and its status: %s", item.status.toString());
228-
log.error(errorMessage);
229-
throw new RuntimeException(errorMessage);
226+
if (item.status != null && item.status.getCode() == HttpURLConnection.HTTP_GONE) {
227+
log.info("Watch connection expired: {}", item.status.getMessage());
228+
return;
229+
} else {
230+
String errorMessage =
231+
String.format("got ERROR event and its status: %s", item.status.toString());
232+
log.error(errorMessage);
233+
throw new RuntimeException(errorMessage);
234+
}
230235
}
231236

232237
ApiType obj = item.object;

0 commit comments

Comments
 (0)