threshold mechanism for checking how much of a post is on the first server
This commit is contained in:
parent
68418615fe
commit
20a423aac8
3 changed files with 31 additions and 11 deletions
|
|
@ -150,6 +150,8 @@ DELEXT=<pattern> Set extension "mark read" pattern.
|
||||||
OPT_MD=<pattern> Set DELEXT just for multi part messages.
|
OPT_MD=<pattern> Set DELEXT just for multi part messages.
|
||||||
OPT_SD=<pattern> Set DELEXT just for single part messages.
|
OPT_SD=<pattern> Set DELEXT just for single part messages.
|
||||||
INCLUDEFILE=<file> Include another file, only works in main config.
|
INCLUDEFILE=<file> Include another file, only works in main config.
|
||||||
|
PRIMARYTHRES=<int> At least this percentage of the post has to be found
|
||||||
|
on the first server.
|
||||||
|
|
||||||
Ruby patterns:
|
Ruby patterns:
|
||||||
--------------
|
--------------
|
||||||
|
|
|
||||||
|
|
@ -641,6 +641,19 @@ def group_is_complete(subj)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def group_percentage_primary(subj)
|
||||||
|
group_subjects unless @grouped
|
||||||
|
groupsize = @groups[subj]["messageinfo"].length
|
||||||
|
primarycount = 0
|
||||||
|
@groups[subj]["messageinfo"].each {|x|
|
||||||
|
if x[:server] == @serverlist[0]
|
||||||
|
primarycount += 1
|
||||||
|
end
|
||||||
|
}
|
||||||
|
percentage = ((100.0/groupsize)*primarycount).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
|
||||||
|
|
|
||||||
|
|
@ -698,7 +698,9 @@ def main
|
||||||
elsif !(@config[group].has_key?("-X") and i =~ /#{@config[group]["-X"]}/) and
|
elsif !(@config[group].has_key?("-X") and i =~ /#{@config[group]["-X"]}/) and
|
||||||
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) && @articles.group_percentage_primary(i)
|
if @articles.group_is_complete(i)
|
||||||
|
if @articles.group_percentage_primary(i) >= ( @config[group].has_key?("PRIMARYTHRES") ?
|
||||||
|
@config[group]["PRIMARYTHRES"].to_i : 0 )
|
||||||
begin
|
begin
|
||||||
if @articles.group_is_singlepart(i)
|
if @articles.group_is_singlepart(i)
|
||||||
get_single(i, group)
|
get_single(i, group)
|
||||||
|
|
@ -711,6 +713,9 @@ 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
|
||||||
else
|
else
|
||||||
print "Not complete: #{i}\n"
|
print "Not complete: #{i}\n"
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue