introduce minimum history size for Markov computation

pull/53/head
Zlatin Balevsky 2020-10-23 20:29:30 +01:00
parent 7c0443abff
commit 43a503514b
No known key found for this signature in database
GPG Key ID: A72832072D525E41
2 changed files with 8 additions and 2 deletions

View File

@ -54,7 +54,7 @@ class MuWireSettings {
Set<String> watchedDirectories
float downloadSequentialRatio
int hostClearInterval, hostHopelessInterval, hostRejectInterval, hostHopelessPurgeInterval
int hostProfileHistory
int hostProfileHistory, minHostProfileHistory
int meshExpiration
int speedSmoothSeconds
boolean embeddedRouter
@ -96,6 +96,7 @@ class MuWireSettings {
hostRejectInterval = Integer.valueOf(props.getProperty("hostRejectInterval", "1"))
hostHopelessPurgeInterval = Integer.valueOf(props.getProperty("hostHopelessPurgeInterval","1440"))
hostProfileHistory = Integer.valueOf(props.getProperty("hostProfileHistory","100"))
minHostProfileHistory = Integer.valueOf(props.getProperty("minHostProfileHistory","3"))
meshExpiration = Integer.valueOf(props.getProperty("meshExpiration","60"))
embeddedRouter = Boolean.valueOf(props.getProperty("embeddedRouter","false"))
plugin = Boolean.valueOf(props.getProperty("plugin","false"))
@ -176,6 +177,7 @@ class MuWireSettings {
props.setProperty("hostRejectInterval", String.valueOf(hostRejectInterval))
props.setProperty("hostHopelessPurgeInterval", String.valueOf(hostHopelessPurgeInterval))
props.setProperty("hostProfileHistory", String.valueOf(hostProfileHistory))
props.setProperty("minHostProfileHistory", String.valueOf(minHostProfileHistory))
props.setProperty("meshExpiration", String.valueOf(meshExpiration))
props.setProperty("embeddedRouter", String.valueOf(embeddedRouter))
props.setProperty("plugin", String.valueOf(plugin))

View File

@ -71,7 +71,11 @@ class H2HostCache extends HostCache {
sql.execute("insert into HOST_ATTEMPTS values ('${d.toBase64()}', '$timestamp', '${status.name()}');")
def count = sql.firstRow("select count(*) as COUNT from HOST_ATTEMPTS where DESTINATION=${d.toBase64()}")
if (count.COUNT < settings.minHostProfileHistory) {
log.fine("not enough history for Markov")
return
}
log.fine("recomputing Markov for ${d.toBase32()} from history items $count.COUNT")
int ss = 0