Skip to content

Commit fbf6782

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

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

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

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -193,24 +193,24 @@ public void handleRecentResourceCreate(ResourceID resourceID, R resource) {
193193
public Optional<R> get(ResourceID resourceID) {
194194
// The order of reading from these caches matters
195195
Optional<R> resource = temporaryResourceCache.getResourceFromCache(resourceID);
196-
var res = cache.get(resourceID);
197196
if (comparableResourceVersions
198197
&& resource.isPresent()
199-
&& (res.isEmpty()
200-
|| ReconcilerUtilsInternal.compareResourceVersions(
201-
resource.get().getMetadata().getResourceVersion(),
202-
res.get().getMetadata().getResourceVersion())
203-
> 0)) {
198+
&& ReconcilerUtilsInternal.compareResourceVersions(
199+
resource.get().getMetadata().getResourceVersion(),
200+
manager().lastSyncResourceVersion(resource.get().getMetadata().getNamespace()))
201+
> 0) {
204202
log.debug("Latest resource found in temporary cache for Resource ID: {}", resourceID);
205203
return resource;
204+
} else {
205+
var resFromInformer = cache.get(resourceID);
206+
log.debug(
207+
"Resource found in temp cache: {}, or older, in temporary cache. Found in informer cache"
208+
+ " {}, for Resource ID: {}",
209+
resource.isPresent(),
210+
resFromInformer.isPresent(),
211+
resourceID);
212+
return resFromInformer;
206213
}
207-
log.debug(
208-
"Resource found in temp cache: {}, or older, in temporary cache. Found in informer cache"
209-
+ " {}, for Resource ID: {}",
210-
resource.isPresent(),
211-
res.isPresent(),
212-
resourceID);
213-
return res;
214214
}
215215

216216
/**

0 commit comments

Comments
 (0)