mirror of
https://github.com/yacy/yacy_search_server.git
synced 2025-07-19 08:44:42 -04:00
fixed some seed selection details
git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@3685 6c8d7289-2bf4-0310-a012-ef5d649a1542
This commit is contained in:
source/de/anomic
@ -55,18 +55,18 @@ public final class serverDate {
|
||||
|
||||
|
||||
// statics
|
||||
private final static long secondMillis = 1000;
|
||||
private final static long minuteMillis = 60 * secondMillis;
|
||||
private final static long hourMillis = 60 * minuteMillis;
|
||||
private final static long dayMillis = 24 * hourMillis;
|
||||
private final static long normalyearMillis = 365 * dayMillis;
|
||||
private final static long leapyearMillis = 366 * dayMillis;
|
||||
private final static int january = 31, normalfebruary = 28, leapfebruary = 29, march = 31,
|
||||
public final static long secondMillis = 1000;
|
||||
public final static long minuteMillis = 60 * secondMillis;
|
||||
public final static long hourMillis = 60 * minuteMillis;
|
||||
public final static long dayMillis = 24 * hourMillis;
|
||||
public final static long normalyearMillis = 365 * dayMillis;
|
||||
public final static long leapyearMillis = 366 * dayMillis;
|
||||
public final static int january = 31, normalfebruary = 28, leapfebruary = 29, march = 31,
|
||||
april = 30, may = 31, june = 30, july = 31, august = 31,
|
||||
september = 30, october = 31, november = 30, december = 31;
|
||||
private final static int[] dimnormal = {january, normalfebruary, march, april, may, june, july, august, september, october, november, december};
|
||||
private final static int[] dimleap = {january, leapfebruary, march, april, may, june, july, august, september, october, november, december};
|
||||
private final static String[] wkday = {"Mon","Tue","Wed","Thu","Fri","Sat","Sun"};
|
||||
public final static int[] dimnormal = {january, normalfebruary, march, april, may, june, july, august, september, october, november, december};
|
||||
public final static int[] dimleap = {january, leapfebruary, march, april, may, june, july, august, september, october, november, december};
|
||||
public final static String[] wkday = {"Mon","Tue","Wed","Thu","Fri","Sat","Sun"};
|
||||
//private final static String[] month = {"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"};
|
||||
|
||||
// find out time zone and DST offset
|
||||
|
@ -458,7 +458,7 @@ public class yacyCore {
|
||||
} else {
|
||||
if (attempts > peerPingMinRunning) { attempts = peerPingMinRunning; }
|
||||
}
|
||||
seeds = seedDB.seedsByAge(false, attempts + 10); // best for seed list maintenance/cleaning
|
||||
seeds = seedDB.seedsByAge(false, attempts); // best for seed list maintenance/cleaning
|
||||
}
|
||||
|
||||
if (seeds == null) { return 0; }
|
||||
|
@ -212,7 +212,7 @@ public class yacySeed {
|
||||
this.dna.put(yacySeed.IPTYPE, "∅");
|
||||
|
||||
// settings that can only be computed by visiting peer
|
||||
this.dna.put(yacySeed.LASTSEEN, yacyCore.universalDateShortString(new Date())); // for last-seen date
|
||||
this.dna.put(yacySeed.LASTSEEN, yacyCore.universalDateShortString(new Date(System.currentTimeMillis() - serverDate.UTCDiff()))); // for last-seen date
|
||||
this.dna.put(yacySeed.USPEED, yacySeed.ZERO); // the computated uplink speed of the peer
|
||||
|
||||
this.dna.put(yacySeed.CRWCNT, yacySeed.ZERO);
|
||||
@ -652,7 +652,7 @@ public class yacySeed {
|
||||
} else {
|
||||
newSeed.dna.put(yacySeed.PORT, Integer.toString(serverCore.getPortNr(sb.getConfig("port", "8080"))));
|
||||
}
|
||||
newSeed.dna.put(yacySeed.BDATE, yacyCore.universalDateShortString(new Date()));
|
||||
newSeed.dna.put(yacySeed.BDATE, yacyCore.universalDateShortString(new Date(System.currentTimeMillis() - serverDate.UTCDiff())) );
|
||||
newSeed.dna.put(yacySeed.LASTSEEN, newSeed.dna.get(yacySeed.BDATE)); // just as initial setting
|
||||
newSeed.dna.put(yacySeed.UTC, serverDate.UTCDiffString());
|
||||
newSeed.dna.put(yacySeed.PEERTYPE, yacySeed.PEERTYPE_VIRGIN);
|
||||
|
@ -71,6 +71,7 @@ import de.anomic.kelondro.kelondroBase64Order;
|
||||
import de.anomic.net.URL;
|
||||
import de.anomic.plasma.plasmaSwitchboard;
|
||||
import de.anomic.server.serverCore;
|
||||
import de.anomic.server.serverDate;
|
||||
import de.anomic.server.serverFileUtils;
|
||||
import de.anomic.server.serverSwitch;
|
||||
import de.anomic.server.logging.serverLog;
|
||||
@ -315,6 +316,7 @@ public final class yacySeedDB {
|
||||
|
||||
public HashMap seedsByAge(boolean up, int count) {
|
||||
// returns a peerhash/yacySeed relation
|
||||
// to get most recent peers, set up = true; for oldest peers, set up = false
|
||||
|
||||
if (count > sizeConnected()) count = sizeConnected();
|
||||
|
||||
@ -329,8 +331,8 @@ public final class yacySeedDB {
|
||||
while ((s.hasMoreElements()) && (searchcount-- > 0)) {
|
||||
ys = (yacySeed) s.nextElement();
|
||||
if ((ys != null) && (ys.get(yacySeed.LASTSEEN, "").length() > 10)) try {
|
||||
absage = Math.abs(System.currentTimeMillis() - ys.getLastSeenUTC());
|
||||
seedScore.addScore(ys.hash, (int) absage);
|
||||
absage = Math.abs(System.currentTimeMillis() + serverDate.dayMillis - ys.getLastSeenUTC());
|
||||
seedScore.addScore(ys.hash, (int) absage); // the higher absage, the older is the peer
|
||||
} catch (Exception e) {}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user