Skip to content

Commit aa79c7f

Browse files
committed
nrt: cache: discardreserved: fix return value
The caches are authoritative regarding the freshness of the data they return. This is the intended meaning of the boolean return value in the GetCachedNRTCopy signature, kinda like "isValid" or "isFresh". So, when there's no data in the cache, the information *IS* fresh and should be reported as such. The cached data is expected to be out of data ("stale", "not fresh", "invalid") only when foreign pods (pods running on a node managed by the scheduler, but not scheduled by this scheduler) are detected, and even so, some cache implementations may tolerate this condition and still report valid data. Signed-off-by: Francesco Romani <[email protected]>
1 parent a2ddb16 commit aa79c7f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pkg/noderesourcetopology/cache/discardreserved.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ func (pt *DiscardReserved) GetCachedNRTCopy(ctx context.Context, nodeName string
6565

6666
nrt := &topologyv1alpha2.NodeResourceTopology{}
6767
if err := pt.client.Get(ctx, types.NamespacedName{Name: nodeName}, nrt); err != nil {
68-
return nil, false
68+
return nil, true
6969
}
7070
return nrt, true
7171
}

0 commit comments

Comments
 (0)