From 45f72ff404815445dcf1574cbd97301e2c7548f9 Mon Sep 17 00:00:00 2001 From: Hongxin Liang Date: Mon, 7 Oct 2019 10:17:38 +0200 Subject: [PATCH] schedule reconnect in case of HTTP_GONE Reset resource version to null and schedule reconnect in case of HTTP_GHONE --- .../dsl/internal/WatchConnectionManager.java | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/internal/WatchConnectionManager.java b/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/internal/WatchConnectionManager.java index 812ae0cae43..afacb0c40b6 100644 --- a/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/internal/WatchConnectionManager.java +++ b/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/internal/WatchConnectionManager.java @@ -255,17 +255,13 @@ public void onMessage(WebSocket webSocket, String message) { } else if (object instanceof Status) { Status status = (Status) object; - // The resource version no longer exists - this has to be handled by the caller. if (status.getCode() == HTTP_GONE) { - webSocketRef.set(null); // lose the ref: closing in close() would only generate a Broken pipe - // exception - // shut down executor, etc. - closeEvent(new KubernetesClientException(status)); - close(); - return; + logger.info("The resource version {} no longer exists. Scheduling a reconnect.", resourceVersion.get()); + resourceVersion.set(null); + scheduleReconnect(); + } else { + logger.error("Error received: {}", status.toString()); } - - logger.error("Error received: {}", status.toString()); } else { logger.error("Unknown message received: {}", message); }