ook fallback threshold...

This commit is contained in:
Ward Wouts 2005-11-17 20:14:09 +00:00
parent 3c3d633903
commit 4459486853
2 changed files with 36 additions and 4 deletions

View file

@ -654,6 +654,28 @@ def group_percentage_primary(subj)
return percentage
end
def group_percentage_fallback(subj)
group_subjects unless @grouped
groupsize = @groups[subj]["messageinfo"].length
fallbackcount = 0
if @serverlist[-1] == @serverlist[0]
return 0
end
onmain = {}
@groups[subj]["messageinfo"].each {|x|
if x[:server] != @serverlist[-1] && onmain[x[:subject]].nil?
onmain[x[:subject]] = 1
end
}
@groups[subj]["messageinfo"].each {|x|
if x[:server] == @serverlist[-1] && onmain[x[:subject]].nil?
fallbackcount += 1
end
}
percentage = ((100.0/groupsize)*fallbackcount).to_i
return percentage
end
def group_is_singlepart(subj)
@groups[subj]["total"].to_i == 1
end

View file

@ -699,8 +699,20 @@ def main
i =~ /#{@config[group]["-I"]}/
print "Match: #{i}\n" if Debuglevel > 0
if @articles.group_is_complete(i)
if @config[group].has_key?("PRIMARYTHRES") &&
( @articles.group_percentage_primary(i) >= @config[group]["PRIMARYTHRES"].to_i )
skip = 0
if @config[group].has_key?("PRIMARYTHRES")
if ( @articles.group_percentage_primary(i) < @config[group]["PRIMARYTHRES"].to_i )
print "Only #{@articles.group_percentage_primary(i)}% of post on primary server, skipping #{i}\n"
skip = 1
end
end
if @config[group].has_key?("FALLBACKTHRES")
if ( @articles.group_percentage_fallback(i) > @config[group]["FALLBACKTHRES"].to_i )
print "#{@articles.group_percentage_fallback(i)}% of post only on fallback server, skipping #{i}\n"
skip = 1
end
end
if ! skip
begin
if @articles.group_is_singlepart(i)
get_single(i, group)
@ -713,8 +725,6 @@ def main
#print "Caught #{$!.class}\n"
#print "Error: #{$!}\n"
end
else
print "Only #{@articles.group_percentage_primary(i)}% of post on primary server, skipping #{i}\n"
end
else
print "Not complete: #{i}\n"