From 60e5aff9fc91a21dfd5c9a45452c0ba2c5b2d213 Mon Sep 17 00:00:00 2001 From: orbiter Date: Thu, 20 Apr 2006 11:53:15 +0000 Subject: [PATCH] some enhancements to the remote crawl trigger git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@2030 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- .../de/anomic/plasma/plasmaSwitchboard.java | 30 +++++++++---------- source/de/anomic/yacy/yacyClient.java | 8 ++--- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/source/de/anomic/plasma/plasmaSwitchboard.java b/source/de/anomic/plasma/plasmaSwitchboard.java index 3afa54b77..86c3d086d 100644 --- a/source/de/anomic/plasma/plasmaSwitchboard.java +++ b/source/de/anomic/plasma/plasmaSwitchboard.java @@ -1161,19 +1161,6 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser log.logInfo("shifted " + toshift + " jobs from global crawl to local crawl"); } - - if (sbQueue.size() >= indexingSlots) { - log.logFine("LimitCrawl: too many processes in indexing queue, dismissed to protect emergency case (" + - "sbQueueSize=" + sbQueue.size() + ")"); - return false; - } - if (cacheLoader.size() >= crawlSlots) { - log.logFine("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) {} @@ -1214,7 +1201,20 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser if (success) return true; } - processLocalCrawling(urlEntry, profile, stats); + processLocalCrawling(urlEntry, profile, stats); // emergency case + + if (sbQueue.size() >= indexingSlots) { + log.logFine("LimitCrawl: too many processes in indexing queue, delayed to protect emergency case (" + + "sbQueueSize=" + sbQueue.size() + ")"); + return false; + } + + if (cacheLoader.size() >= crawlSlots) { + log.logFine("LimitCrawl: too many processes in loader queue, delayed to protect emergency case (" + + "cacheLoader=" + cacheLoader.size() + ")"); + return false; + } + return true; } catch (IOException e) { log.logSevere(stats + ": CANNOT FETCH ENTRY: " + e.getMessage()); @@ -1706,7 +1706,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser // do the request try { - HashMap page = yacyClient.crawlOrder(remoteSeed, urlEntry.url(), urlPool.getURL(urlEntry.referrerHash())); + HashMap page = yacyClient.crawlOrder(remoteSeed, urlEntry.url(), urlPool.getURL(urlEntry.referrerHash()), 6000); // check success /* diff --git a/source/de/anomic/yacy/yacyClient.java b/source/de/anomic/yacy/yacyClient.java index 727b2e007..5ba9633ed 100644 --- a/source/de/anomic/yacy/yacyClient.java +++ b/source/de/anomic/yacy/yacyClient.java @@ -733,11 +733,11 @@ public final class yacyClient { return "wrong protocol: " + protocol; } - public static HashMap crawlOrder(yacySeed targetSeed, URL url, URL referrer) { - return crawlOrder(targetSeed,new URL[]{url},new URL[]{referrer}); + public static HashMap crawlOrder(yacySeed targetSeed, URL url, URL referrer, int timeout) { + return crawlOrder(targetSeed, new URL[]{url}, new URL[]{referrer}, timeout); } - public static HashMap crawlOrder(yacySeed targetSeed, URL[] url, URL[] referrer) { + public static HashMap crawlOrder(yacySeed targetSeed, URL[] url, URL[] referrer, int timeout) { // this post a message to the remote message board if (targetSeed == null) { return null; } if (yacyCore.seedDB.mySeed == null) { return null; } @@ -777,7 +777,7 @@ public final class yacyClient { return nxTools.table( httpc.wput( new URL("http://" + address + "/yacy/crawlOrder.html"), - 60000, + timeout, null, null, (useProxy)?yacyCore.seedDB.sb.remoteProxyConfig:null,