Skip to content

Commit

Permalink
fixed bad remote crawl behavior
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@453 6c8d7289-2bf4-0310-a012-ef5d649a1542
  • Loading branch information
orbiter committed Jul 29, 2005
1 parent f32d8bd commit cdbbfd5
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 12 deletions.
26 changes: 14 additions & 12 deletions source/de/anomic/plasma/plasmaSwitchboard.java
Expand Up @@ -529,6 +529,7 @@ public void close() {
wordIndex.close(waitingBoundSeconds);
log.logSystem("SWITCHBOARD SHUTDOWN STEP 3: sending termination signal to database manager");
try {
indexDistribution.close();
cacheLoader.close();
wikiDB.close();
messageDB.close();
Expand Down Expand Up @@ -736,6 +737,19 @@ public boolean limitCrawlTriggerJob() {
} catch (IOException e) {}
}


if (sbQueue.size() >= indexingSlots) {
log.logDebug("LimitCrawl: too many processes in indexing queue, dismissed to protect emergency case (" +
"sbQueueSize=" + sbQueue.size() + ")");
return false;
}
if (cacheLoader.size() >= crawlSlots) {
log.logDebug("LimitCrawl: too many processes in loader queue, dismissed to protect emergency case (" +
"cacheLoader=" + cacheLoader.size() + ")");
return false;
}


// if the server is busy, we do crawling more slowly
//if (!(cacheManager.idle())) try {Thread.currentThread().sleep(2000);} catch (InterruptedException e) {}

Expand Down Expand Up @@ -779,18 +793,6 @@ public boolean limitCrawlTriggerJob() {
if (success) return true;
}

// alternatively do a local crawl
if (sbQueue.size() >= indexingSlots) {
log.logDebug("LimitCrawl: too many processes in indexing queue, dismissed (" +
"sbQueueSize=" + sbQueue.size() + ")");
return false;
}
if (cacheLoader.size() >= crawlSlots) {
log.logDebug("LimitCrawl: too many processes in loader queue, dismissed (" +
"cacheLoader=" + cacheLoader.size() + ")");
return false;
}

processLocalCrawling(urlEntry, profile, stats);
return true;
}
Expand Down
14 changes: 14 additions & 0 deletions source/de/anomic/plasma/plasmaWordIndexDistribution.java
Expand Up @@ -28,13 +28,15 @@ public class plasmaWordIndexDistribution {
private plasmaWordIndex wordIndex;
private serverLog log;
private boolean enabled;
private boolean closed;

public plasmaWordIndexDistribution(plasmaURLPool urlPool, plasmaWordIndex wordIndex, serverLog log,
boolean enable) {
this.urlPool = urlPool;
this.wordIndex = wordIndex;
this.enabled = enable;
this.log = log;
this.closed = false;
setCounts(100 /*indexCount*/, 1 /*juniorPeerCount*/, 3 /*seniorPeerCount*/, 8000);
}

Expand All @@ -46,8 +48,16 @@ public void disable() {
enabled = false;
}

public void close() {
closed = true;
}

public boolean job() {

if (this.closed) {
log.logDebug("no word distribution: closed");
return false;
}
if (yacyCore.seedDB == null) {
log.logDebug("no word distribution: seedDB == null");
return false;
Expand Down Expand Up @@ -131,6 +141,10 @@ public int performTransferIndex(int indexCount, int peerCount, boolean delete) {
String error;
String peerNames = "";
while ((e.hasMoreElements()) && (hc < peerCount)) {
if (closed) {
log.logError("Index distribution interrupted by close, nothing deleted locally.");
return -1; // interrupted
}
seed = (yacySeed) e.nextElement();
if (seed != null) {
error = yacyClient.transferIndex(seed, indexEntities, urlPool.loadedURL);
Expand Down

0 comments on commit cdbbfd5

Please sign in to comment.