From deef34de22687e6905d8829e55ae2b45b99e5db1 Mon Sep 17 00:00:00 2001 From: Xiaodan Date: Thu, 29 Aug 2024 17:03:12 -0700 Subject: [PATCH] fix how we record cycle start and end time --- .../com/netflix/hollow/api/client/HollowClientUpdater.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hollow/src/main/java/com/netflix/hollow/api/client/HollowClientUpdater.java b/hollow/src/main/java/com/netflix/hollow/api/client/HollowClientUpdater.java index 82590dd3f..1003b1790 100644 --- a/hollow/src/main/java/com/netflix/hollow/api/client/HollowClientUpdater.java +++ b/hollow/src/main/java/com/netflix/hollow/api/client/HollowClientUpdater.java @@ -117,7 +117,6 @@ public synchronized boolean updateTo(long requestedVersion) throws Throwable { return updateTo(new HollowConsumer.VersionInfo(requestedVersion)); } public synchronized boolean updateTo(HollowConsumer.VersionInfo requestedVersionInfo) throws Throwable { - metrics.setLastRefreshStartNs(System.nanoTime()); long requestedVersion = requestedVersionInfo.getVersion(); if (requestedVersion == getCurrentVersionId()) { if (requestedVersion == HollowConstants.VERSION_NONE && hollowDataHolderVolatile == null) { @@ -128,6 +127,7 @@ public synchronized boolean updateTo(HollowConsumer.VersionInfo requestedVersion } return true; } + metrics.setLastRefreshStartNs(System.nanoTime()); // Take a snapshot of the listeners to ensure additions or removals may occur concurrently // but will not take effect until a subsequent refresh @@ -168,8 +168,10 @@ public synchronized boolean updateTo(HollowConsumer.VersionInfo requestedVersion && requestedVersion == HollowConstants.VERSION_LATEST) throw new IllegalArgumentException("Could not create an update plan, because no existing versions could be retrieved."); - if (updatePlan.destinationVersion(requestedVersion) == getCurrentVersionId()) + if (updatePlan.destinationVersion(requestedVersion) == getCurrentVersionId()) { + metrics.setLastRefreshEndNs(System.nanoTime()); return true; + } if (updatePlan.isSnapshotPlan()) { // 1 snapshot and 0+ delta transitions HollowDataHolder oldDh = hollowDataHolderVolatile;