mirror of
https://github.com/yacy/yacy_search_server.git
synced 2024-09-19 00:01:41 +02:00
- remove superfluous entries in remote search tracker handles
- avoid concurrent access from same client this is a fix for http://forum.yacy-websuche.de/viewtopic.php?p=20045#p20045 git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@6866 6c8d7289-2bf4-0310-a012-ef5d649a1542
This commit is contained in:
parent
789c6b26ce
commit
586bc4d920
|
@ -146,14 +146,16 @@ public final class search {
|
|||
TreeSet<Long> trackerHandles = sb.remoteSearchTracker.get(client);
|
||||
if (trackerHandles == null) trackerHandles = new TreeSet<Long>();
|
||||
boolean block = false;
|
||||
if (trackerHandles.tailSet(Long.valueOf(System.currentTimeMillis() - 3000)).size() > 1) {
|
||||
block = true;
|
||||
}
|
||||
if (trackerHandles.tailSet(Long.valueOf(System.currentTimeMillis() - 60000)).size() > 12) {
|
||||
block = true;
|
||||
}
|
||||
if (trackerHandles.tailSet(Long.valueOf(System.currentTimeMillis() - 600000)).size() > 36) {
|
||||
block = true;
|
||||
synchronized (trackerHandles) {
|
||||
if (trackerHandles.tailSet(Long.valueOf(System.currentTimeMillis() - 3000)).size() > 1) {
|
||||
block = true;
|
||||
}
|
||||
if (trackerHandles.tailSet(Long.valueOf(System.currentTimeMillis() - 60000)).size() > 12) {
|
||||
block = true;
|
||||
}
|
||||
if (trackerHandles.tailSet(Long.valueOf(System.currentTimeMillis() - 600000)).size() > 36) {
|
||||
block = true;
|
||||
}
|
||||
}
|
||||
if (block) {
|
||||
prop.put("links", "");
|
||||
|
@ -386,10 +388,13 @@ public final class search {
|
|||
sb.remoteSearches.add(theQuery);
|
||||
|
||||
// update the search tracker
|
||||
trackerHandles.add(theQuery.handle);
|
||||
synchronized (trackerHandles) {
|
||||
trackerHandles.add(theQuery.handle); // thats the time when the handle was created
|
||||
// we don't need too much entries in the list; remove superfluous
|
||||
while (trackerHandles.size() > 36) if (!trackerHandles.remove(trackerHandles.first())) break;
|
||||
}
|
||||
sb.remoteSearchTracker.put(client, trackerHandles);
|
||||
|
||||
|
||||
// log
|
||||
yacyCore.log.logInfo("EXIT HASH SEARCH: " +
|
||||
QueryParams.anonymizedQueryHashes(theQuery.queryHashes) + " - " + joincount + " links found, " +
|
||||
|
|
Loading…
Reference in New Issue
Block a user