mirror of https://github.com/zlatinb/muwire
actually add timestamps to the list
parent
1780901cb0
commit
4468a262ae
|
@ -162,8 +162,10 @@ abstract class Connection implements Closeable {
|
||||||
|
|
||||||
private boolean throttleSearch() {
|
private boolean throttleSearch() {
|
||||||
final long now = System.currentTimeMillis()
|
final long now = System.currentTimeMillis()
|
||||||
if (searchTimestamps.size() < SEARCHES)
|
if (searchTimestamps.size() < SEARCHES) {
|
||||||
|
searchTimestamps.addLast(now)
|
||||||
return false
|
return false
|
||||||
|
}
|
||||||
Long oldest = searchTimestamps.getFirst()
|
Long oldest = searchTimestamps.getFirst()
|
||||||
if (now - oldest.longValue() < INTERVAL)
|
if (now - oldest.longValue() < INTERVAL)
|
||||||
return true
|
return true
|
||||||
|
|
Loading…
Reference in New Issue