Skip to content

Commit

Permalink
fix how we record cycle start and end time
Browse files Browse the repository at this point in the history
  • Loading branch information
workeatsleep committed Aug 30, 2024
1 parent a7140bd commit deef34d
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit deef34d

Please sign in to comment.