actually add timestamps to the list

This commit is contained in:
Zlatin Balevsky
2019-06-30 21:40:18 +01:00
parent 1780901cb0
commit 4468a262ae

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