From 6234b3f36a39316e7706c180f4bd158e882c1ecd Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Thu, 2 Jun 2022 10:14:09 +1000 Subject: [PATCH] Fix #8067 Use nanotime for DosFilter rate tracker updates from review --- .../src/main/java/org/eclipse/jetty/servlets/DoSFilter.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/DoSFilter.java b/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/DoSFilter.java index 6f3f11aeed3d..69e438258ea5 100644 --- a/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/DoSFilter.java +++ b/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/DoSFilter.java @@ -1216,7 +1216,7 @@ public RateTracker(ServletContext context, String filterName, String id, RateTyp } /** - * @param now the time now (in milliseconds) + * @param now the time now (in nanoseconds) * @return the current calculated request rate over the last second */ public OverLimit isRateExceeded(long now) @@ -1237,7 +1237,7 @@ public OverLimit isRateExceeded(long now) long rate = (now - last); if (TimeUnit.NANOSECONDS.toSeconds(rate) < 1L) { - return new Overage(Duration.ofMillis(rate), _maxRequestsPerSecond); + return new Overage(Duration.ofNanos(rate), _maxRequestsPerSecond); } return null; }