Skip to content

Commit a4d20ff

Browse files
committed
wip
Signed-off-by: Attila Mészáros <a_meszaros@apple.com>
1 parent 0c70dbc commit a4d20ff

File tree

2 files changed

+11
-18
lines changed

2 files changed

+11
-18
lines changed

operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/source/informer/InformerEventSource.java

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -195,20 +195,6 @@ private synchronized void onAddOrUpdate(
195195

196196
private boolean canSkipEvent(R newObject, R oldObject, ResourceID resourceID) {
197197
return !temporaryResourceCache.isNewerThenKnownResource(newObject, resourceID);
198-
// if (res.isEmpty()) {
199-
// return false;
200-
// }
201-
// boolean resVersionsEqual =
202-
// newObject
203-
// .getMetadata()
204-
// .getResourceVersion()
205-
// .equals(res.get().getMetadata().getResourceVersion());
206-
// log.debug(
207-
// "Resource found in temporal cache for id: {} resource versions equal: {}",
208-
// resourceID,
209-
// resVersionsEqual);
210-
// return resVersionsEqual || temporaryResourceCache.isLaterResourceVersion(res.get(),
211-
// newObject);
212198
}
213199

214200
private void propagateEvent(R object) {

operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/source/informer/TemporaryResourceCache.java

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,10 +151,17 @@ public synchronized void putResource(T newResource, String previousResourceVersi
151151
newResource.getMetadata().getResourceVersion(),
152152
resourceId);
153153
cache.put(resourceId, newResource);
154-
} else if (cache.remove(resourceId) != null) {
155-
log.debug("Removed an obsolete resource from cache for id: {}", resourceId);
156-
latestUpdatedVersion.put(
157-
resourceId, Long.parseLong(newResource.getMetadata().getResourceVersion()));
154+
} else {
155+
if (newResource
156+
.getMetadata()
157+
.getResourceVersion()
158+
.equals(cachedResource.getMetadata().getResourceVersion())) {
159+
latestUpdatedVersion.put(
160+
resourceId, Long.parseLong(newResource.getMetadata().getResourceVersion()));
161+
}
162+
if (cache.remove(resourceId) != null) {
163+
log.debug("Removed an obsolete resource from cache for id: {}", resourceId);
164+
}
158165
}
159166
}
160167

0 commit comments

Comments
 (0)