Skip to content

Commit

Permalink
fix for busyCacheFlush detection
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@2365 6c8d7289-2bf4-0310-a012-ef5d649a1542
  • Loading branch information
orbiter committed Aug 7, 2006
1 parent f58283d commit ec5149f
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions htroot/yacy/transferRWI.java
Expand Up @@ -90,9 +90,16 @@ public static serverObjects respond(httpHeader header, serverObjects post, serve
StringBuffer unknownURLs = new StringBuffer();
int pause = 0;

boolean shortCacheFlush = false;
if ((granted) && (sb.wordIndex.busyCacheFlush)) {
// wait a little bit, maybe we got into a short flush slot
for (int i = 0; i < 20; i++) if (sb.wordIndex.busyCacheFlush) try {Thread.sleep(100);} catch (InterruptedException e) {}
for (int i = 0; i < 20; i++) {
if (!(sb.wordIndex.busyCacheFlush)) {
shortCacheFlush = true;
break;
}
try {Thread.sleep(100);} catch (InterruptedException e) {}
}
}

if (!granted) {
Expand All @@ -106,7 +113,7 @@ public static serverObjects respond(httpHeader header, serverObjects post, serve
granted = false; // don't accept more words if there are too many words to flush
result = "busy";
pause = 60000;
} else if ((checkLimit && sb.wordIndex.wSize() > sb.wordIndex.getMaxWordCount()) || (sb.wordIndex.busyCacheFlush)) {
} else if ((checkLimit && sb.wordIndex.wSize() > sb.wordIndex.getMaxWordCount()) || ((sb.wordIndex.busyCacheFlush) && (!shortCacheFlush))) {
// we are too busy flushing the ramCache to receive indexes
sb.getLog().logInfo("Rejecting RWIs from peer " + otherPeerName + ". We are too busy (wordcachesize=" + sb.wordIndex.wSize() + ").");
granted = false; // don't accept more words if there are too many words to flush
Expand Down

0 comments on commit ec5149f

Please sign in to comment.