diff --git a/shared/src/main/java/net/chrotos/ingress/minecraft/Watcher.java b/shared/src/main/java/net/chrotos/ingress/minecraft/Watcher.java index 11e6069..f21e9cf 100644 --- a/shared/src/main/java/net/chrotos/ingress/minecraft/Watcher.java +++ b/shared/src/main/java/net/chrotos/ingress/minecraft/Watcher.java @@ -24,7 +24,7 @@ public Watcher(PodRessourceHandler handler) throws IOException { apiClient.getHttpClient().newBuilder().readTimeout(0, TimeUnit.SECONDS).build(); apiClient.setHttpClient(httpClient); - SharedInformerFactory factory = new SharedInformerFactory(); + factory = new SharedInformerFactory(); SharedIndexInformer podInformer = factory.sharedIndexInformerFor( (CallGeneratorParams params) -> { return v1Api.listNamespacedPodCall( @@ -61,18 +61,16 @@ public void onUpdate(V1Pod oldObj, V1Pod newObj) { if (!oldStream.findAny().isPresent() && newStream.findAny().isPresent()) { handler.onEventReceived(newObj, false); } + + if (oldStream.findAny().isPresent() && !newStream.findAny().isPresent()) { + handler.onEventReceived(oldObj, true); + } } @Override - public void onDelete(V1Pod obj, boolean deletedFinalStateUnknown) { - - - handler.onEventReceived(obj, true); - } + public void onDelete(V1Pod obj, boolean deletedFinalStateUnknown) { } } ); - - factory.startAllRegisteredInformers(); } public void start() {