Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
package io.javaoperatorsdk.operator.api.reconciler;

import java.lang.reflect.InvocationTargetException;
import java.time.LocalTime;
import java.time.temporal.ChronoUnit;
import java.util.concurrent.TimeUnit;
import java.util.function.Predicate;
import java.util.function.UnaryOperator;

Expand Down Expand Up @@ -232,9 +231,8 @@ private static <P extends HasMetadata> P pollLocalCache(
Context<P> context, P staleResource, long timeoutMillis, long pollDelayMillis) {
try {
var resourceId = ResourceID.fromResource(staleResource);
var startTime = LocalTime.now();
final var timeoutTime = startTime.plus(timeoutMillis, ChronoUnit.MILLIS);
while (timeoutTime.isAfter(LocalTime.now())) {
final var deadlineNanos = System.nanoTime() + TimeUnit.MILLISECONDS.toNanos(timeoutMillis);
while (System.nanoTime() - deadlineNanos < 0) {
Comment on lines 233 to +235
log.debug("Polling cache for resource: {}", resourceId);
var cachedResource = context.getPrimaryCache().get(resourceId).orElseThrow();
if (!cachedResource
Expand Down
Loading