actually add timestamps to the list

pull/9/head
Zlatin Balevsky 2019-06-30 21:40:18 +01:00
parent 1780901cb0
commit 4468a262ae
1 changed files with 3 additions and 1 deletions

View File

@ -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