better control of index flush

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@2364 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 19 years ago
parent 4be21a3cab
commit f58283def2

@ -89,7 +89,12 @@ public final class transferRWI {
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.");

@ -198,14 +198,15 @@ public final class plasmaWordIndex extends indexAbstractRI implements indexRI {
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++) {

Loading…
Cancel
Save