File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
google-cloud-storage/src/main/java/com/google/cloud/storage Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -38,20 +38,20 @@ private ThroughputMovingWindow(Duration window) {
3838 }
3939
4040 void add (Instant now , Throughput value ) {
41- houseKeeping (now );
41+ removeExpiredEntries (now );
4242 values .add (new Entry (now , value ));
4343 }
4444
4545 Throughput avg (Instant now ) {
46- houseKeeping (now );
46+ removeExpiredEntries (now );
4747 return values .stream ()
4848 .map (Entry ::getValue )
4949 .reduce (
5050 Throughput .zero (),
5151 (tp1 , tp2 ) -> Throughput .of (tp1 .getNumBytes () + tp2 .getNumBytes (), window ));
5252 }
5353
54- private void houseKeeping (Instant now ) {
54+ private void removeExpiredEntries (Instant now ) {
5555 Instant newMin = now .minus (window );
5656 values .removeIf (e -> lteq (e .getAt (), newMin ));
5757 }
You can’t perform that action at this time.
0 commit comments