Skip to content

Commit ece5807

Browse files
csviriCopilot
andauthored
Update operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/source/informer/ManagedInformerEventSource.java
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 13a779f commit ece5807

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -183,11 +183,11 @@ public void handleRecentResourceCreate(ResourceID resourceID, R resource) {
183183

184184
@Override
185185
public Optional<R> get(ResourceID resourceID) {
186-
// order of these two resource gets matter, since other way around
187-
// there can be a race condition that we read the resource from the cache
188-
// it is not found. But, right after that we process an event for the informer that
189-
// evicts the temporal resource cache, so at the end resource won't be found in temp cache
190-
// however it is there already in informer cache at that moment.
186+
// The order of these two lookups matters. If we queried the informer cache first,
187+
// a race condition could occur: we might not find the resource there yet, then
188+
// process an informer event that evicts the temporary resource cache entry. At that
189+
// point the resource would already be present in the informer cache, but we would
190+
// have missed it in both caches during this call.
191191
Optional<R> resource = temporaryResourceCache.getResourceFromCache(resourceID);
192192
var res = cache.get(resourceID);
193193
if (comparableResourceVersions

0 commit comments

Comments
 (0)