Skip to content

Commit 226be1e

Browse files
committed
additional condition
1 parent f1ad528 commit 226be1e

File tree

1 file changed

+7
-2
lines changed
  • operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/source/cache

1 file changed

+7
-2
lines changed

operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/source/cache/BoundedItemStore.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,14 +121,19 @@ protected R refreshMissingStateFromServer(String key) {
121121
var newRes = resourceFetcher.fetchResource(key);
122122
synchronized (this) {
123123
log.debug("Fetched resource: {}", newRes);
124+
var actual = cache.get(key);
124125
if (newRes == null) {
125-
existingMinimalResources.remove(key);
126+
// double-checking if actual, not received since.
127+
// If received we just return. Since the resource from informer should be always leading,
128+
// even if the fetched resource is null, this will be eventually received as an event.
129+
if (actual == null) {
130+
existingMinimalResources.remove(key);
131+
}
126132
return null;
127133
}
128134
// Just want to put the fetched resource if there is still no resource published from
129135
// different source. In case of informers actually multiple events might arrive, therefore non
130136
// fetched resource should take always precedence.
131-
var actual = cache.get(key);
132137
if (actual == null) {
133138
cache.put(key, newRes);
134139
existingMinimalResources.put(key, createMinimalResource(newRes));

0 commit comments

Comments
 (0)