ook fallback threshold...
This commit is contained in:
parent
3c3d633903
commit
4459486853
2 changed files with 36 additions and 4 deletions
|
|
@ -654,6 +654,28 @@ def group_percentage_primary(subj)
|
||||||
return percentage
|
return percentage
|
||||||
end
|
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)
|
def group_is_singlepart(subj)
|
||||||
@groups[subj]["total"].to_i == 1
|
@groups[subj]["total"].to_i == 1
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -699,8 +699,20 @@ def main
|
||||||
i =~ /#{@config[group]["-I"]}/
|
i =~ /#{@config[group]["-I"]}/
|
||||||
print "Match: #{i}\n" if Debuglevel > 0
|
print "Match: #{i}\n" if Debuglevel > 0
|
||||||
if @articles.group_is_complete(i)
|
if @articles.group_is_complete(i)
|
||||||
if @config[group].has_key?("PRIMARYTHRES") &&
|
skip = 0
|
||||||
( @articles.group_percentage_primary(i) >= @config[group]["PRIMARYTHRES"].to_i )
|
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
|
begin
|
||||||
if @articles.group_is_singlepart(i)
|
if @articles.group_is_singlepart(i)
|
||||||
get_single(i, group)
|
get_single(i, group)
|
||||||
|
|
@ -713,8 +725,6 @@ def main
|
||||||
#print "Caught #{$!.class}\n"
|
#print "Caught #{$!.class}\n"
|
||||||
#print "Error: #{$!}\n"
|
#print "Error: #{$!}\n"
|
||||||
end
|
end
|
||||||
else
|
|
||||||
print "Only #{@articles.group_percentage_primary(i)}% of post on primary server, skipping #{i}\n"
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
print "Not complete: #{i}\n"
|
print "Not complete: #{i}\n"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue