From 4468a262ae1720f88819de54ff66427c70c0804a Mon Sep 17 00:00:00 2001 From: Zlatin Balevsky Date: Sun, 30 Jun 2019 21:40:18 +0100 Subject: [PATCH] actually add timestamps to the list --- .../main/groovy/com/muwire/core/connection/Connection.groovy | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/src/main/groovy/com/muwire/core/connection/Connection.groovy b/core/src/main/groovy/com/muwire/core/connection/Connection.groovy index b1b2ad64..790a1a26 100644 --- a/core/src/main/groovy/com/muwire/core/connection/Connection.groovy +++ b/core/src/main/groovy/com/muwire/core/connection/Connection.groovy @@ -162,8 +162,10 @@ abstract class Connection implements Closeable { private boolean throttleSearch() { final long now = System.currentTimeMillis() - if (searchTimestamps.size() < SEARCHES) + if (searchTimestamps.size() < SEARCHES) { + searchTimestamps.addLast(now) return false + } Long oldest = searchTimestamps.getFirst() if (now - oldest.longValue() < INTERVAL) return true