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() {
|
||||
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
|
||||
|
|
Loading…
Reference in New Issue