mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-20 11:10:00 +00:00
fixed lastRequest update and cache hit count update
This commit is contained in:
1 parent
20d12939f8
commit
a7ab4c93c6
1 file changed
+5
-2
+5
-2
@@ -100,16 +100,19 @@ public class LiveLeaderboardUpdater implements Runnable {
|
||||
|
||||
public LeaderboardDTO getLiveLeaderboard(Collection<String> namesOfRaceColumnsForWhichToLoadLegDetails) throws NoWindException {
|
||||
final MillisecondsTimePoint now = MillisecondsTimePoint.now();
|
||||
TimePoint timePoint = now.minus(getLeaderboard().getDelayToLiveInMillis());
|
||||
LeaderboardDTO result = null;
|
||||
synchronized (this) {
|
||||
if (columnNamesForWhichCurrentLiveLeaderboardHasTheDetails.containsAll(namesOfRaceColumnsForWhichToLoadLegDetails)) {
|
||||
result = currentLiveLeaderboard;
|
||||
cacheHitCount++;
|
||||
lastRequest = timePoint;
|
||||
if (result != null) {
|
||||
cacheHitCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (result == null) { // current cache doesn't have the column details requested; re-calculate
|
||||
cacheMissCount++;
|
||||
TimePoint timePoint = now.minus(getLeaderboard().getDelayToLiveInMillis());
|
||||
result = sailingService.computeLeaderboardByName(leaderboardName, timePoint, namesOfRaceColumnsForWhichToLoadLegDetails,
|
||||
/* waitForLatestAnalyses */ false);
|
||||
updateRequestTimes(namesOfRaceColumnsForWhichToLoadLegDetails, result, timePoint);
|
||||
|
||||
Reference in new issue
Block a user