Skip to content

Commit

Permalink
better control of index flush
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@2364 6c8d7289-2bf4-0310-a012-ef5d649a1542
  • Loading branch information
orbiter committed Aug 7, 2006
1 parent 4be21a3 commit f58283d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
7 changes: 6 additions & 1 deletion htroot/yacy/transferRWI.java
Expand Up @@ -89,7 +89,12 @@ public static serverObjects respond(httpHeader header, serverObjects post, serve
String result = "ok";
StringBuffer unknownURLs = new StringBuffer();
int pause = 0;


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) {}
}

if (!granted) {
// we dont want to receive indexes
sb.getLog().logInfo("Rejecting RWIs from peer " + otherPeerName + ". Not granted.");
Expand Down
5 changes: 3 additions & 2 deletions source/de/anomic/plasma/plasmaWordIndex.java
Expand Up @@ -198,14 +198,15 @@ public void flushCacheSome() {
synchronized (this) { ramCache.shiftK2W(); }
System.out.println("DEBUG-B");
int flushCount = ramCache.wSize() / 500;
if (flushCount > 70) flushCount = 70;
if (flushCount < 5) flushCount = 5;
if (flushCount > 80) flushCount = 80;
if (flushCount < 10) flushCount = Math.min(10, ramCache.wSize());
System.out.println("DEBUG-C");
flushCache(flushCount);
System.out.println("DEBUG-D");
}

public void flushCache(int count) {
if (count <= 0) return;
synchronized (ramCache) {
busyCacheFlush = true;
for (int i = 0; i < count; i++) {
Expand Down

0 comments on commit f58283d

Please sign in to comment.