|
18 | 18 | public class OperatorShutdownHandler { |
19 | 19 | private static final Logger LOGGER = LoggerFactory.getLogger(OperatorShutdownHandler.class); |
20 | 20 | private static final int SALT_FAILURE_LOG_INTERVAL_MINUTES = 10; |
21 | | - private static final int STORE_REFRESH_STALENESS_CHECK_INTERVAL_MINUTES = 60; |
| 21 | + private static final int STORE_REFRESH_STALENESS_CHECK_INTERVAL_MINUTES = 5; // Temporarily reduced to 5 min for testing |
22 | 22 | private final Duration attestShutdownWaitTime; |
23 | 23 | private final Duration saltShutdownWaitTime; |
24 | 24 | private final Duration storeRefreshStaleTimeout; |
@@ -81,15 +81,27 @@ public void handleAttestResponse(Pair<AttestationResponseCode, String> response) |
81 | 81 | } |
82 | 82 |
|
83 | 83 | public void handleStoreRefresh(String storeName) { |
| 84 | + Instant now = clock.instant(); |
84 | 85 | lastSuccessfulRefreshTimes.computeIfAbsent(storeName, k -> new AtomicReference<>()) |
85 | | - .set(clock.instant()); |
| 86 | + .set(now); |
| 87 | + LOGGER.debug("Recorded successful refresh for store '{}' at {}", storeName, now); |
86 | 88 | } |
87 | 89 |
|
88 | 90 | public void checkStoreRefreshStaleness() { |
89 | 91 | Instant now = clock.instant(); |
| 92 | + LOGGER.debug("Checking store refresh staleness at {}", now); |
| 93 | + |
90 | 94 | for (Map.Entry<String, AtomicReference<Instant>> entry : lastSuccessfulRefreshTimes.entrySet()) { |
91 | 95 | String storeName = entry.getKey(); |
92 | 96 | Instant lastSuccess = entry.getValue().get(); |
| 97 | + |
| 98 | + if (lastSuccess != null) { |
| 99 | + Duration timeSinceLastRefresh = Duration.between(lastSuccess, now); |
| 100 | + LOGGER.debug("Store '{}': last successful refresh at {}, {} hours ago", |
| 101 | + storeName, lastSuccess, timeSinceLastRefresh.toHours()); |
| 102 | + } else { |
| 103 | + LOGGER.debug("Store '{}': no successful refresh recorded yet", storeName); |
| 104 | + } |
93 | 105 |
|
94 | 106 | if (lastSuccess == null) { |
95 | 107 | // Store hasn't had a successful refresh yet |
|
0 commit comments