Skip to content

Commit

Permalink
Improve ongoing pass calc
Browse files Browse the repository at this point in the history
See merge request main/Sumatra!1851

sumatra-commit: b0024ac73b72ff54acac61df698912d9ed90e55a
  • Loading branch information
g3force authored and TIGERs GitLab committed Jun 1, 2024
1 parent 80fd143 commit 51692a4
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ private void reduceBySize()
}
while (data.size() > maxElements)
{
data.remove(0);
data.removeFirst();
}
}

Expand All @@ -85,11 +85,11 @@ private void reduceByDuration()
// no duration limit
return;
}
long maxTimestamp = data.get(data.size() - 1).timestamp;
long maxTimestamp = data.getLast().timestamp;
long minTimestamp = maxTimestamp - (long) (maxDuration * 1e9);
while (!data.isEmpty() && data.get(0).timestamp < minTimestamp)
while (!data.isEmpty() && data.getFirst().timestamp < minTimestamp)
{
data.remove(0);
data.removeFirst();
}
}

Expand All @@ -105,9 +105,9 @@ public void reduceByAbsoluteDuration(long currentTimestamp)
// no duration limit
return;
}
while (!data.isEmpty() && data.get(0).timestamp < currentTimestamp - (long) (maxDuration * 1e9))
while (!data.isEmpty() && data.getFirst().timestamp < currentTimestamp - (long) (maxDuration * 1e9))
{
data.remove(0);
data.removeFirst();
}
}

Expand Down

0 comments on commit 51692a4

Please sign in to comment.