- sort cache before saveing (I think this will make reading it less
memory consuming and a bit faster) - should fix "strange things going on" problem (not sure though)
This commit is contained in:
parent
45c50b1c7c
commit
20d7b4ff26
1 changed files with 11 additions and 11 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
# $Dwarf: article.rb,v 1.76 2003/08/18 22:14:02 ward Exp $
|
# $Dwarf: article.rb,v 1.77 2003/08/31 17:30:13 ward Exp $
|
||||||
# $Source$
|
# $Source$
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|
@ -563,17 +563,17 @@ def save_cache(cachedir, server)
|
||||||
if FileTest.directory?( cachedir )
|
if FileTest.directory?( cachedir )
|
||||||
file = File.new( "#{filename}.#{server}.new", "w" ) or print "couldn't open cachefile for writing\n"
|
file = File.new( "#{filename}.#{server}.new", "w" ) or print "couldn't open cachefile for writing\n"
|
||||||
print "Updating cache...\n"
|
print "Updating cache...\n"
|
||||||
# cache = []
|
cache = []
|
||||||
# for i in (0...@subjects.length)
|
|
||||||
# cache.push("#{@ids[i]}|#{@messids[i]}|#{@servers[i]}|#{@subjects[i]}\n")
|
|
||||||
# end
|
|
||||||
# cache.sort!
|
|
||||||
# file.print cache
|
|
||||||
for i in (0...@subjects.length)
|
for i in (0...@subjects.length)
|
||||||
if @servers[i] == server
|
cache.push("#{@ids[i]}|#{@messids[i]}|#{@subjects[i]}\n") if @servers[i] == server
|
||||||
file.print "#{@ids[i]}|#{@messids[i]}|#{@subjects[i]}\n"
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
cache.sort!
|
||||||
|
file.print cache
|
||||||
|
# for i in (0...@subjects.length)
|
||||||
|
# if @servers[i] == server
|
||||||
|
# file.print "#{@ids[i]}|#{@messids[i]}|#{@subjects[i]}\n"
|
||||||
|
# end
|
||||||
|
# end
|
||||||
file.close
|
file.close
|
||||||
if ( File.move("#{filename}.#{server}.new", "#{filename}.#{server}") )
|
if ( File.move("#{filename}.#{server}.new", "#{filename}.#{server}") )
|
||||||
print "Cache updated for #{server}\n"
|
print "Cache updated for #{server}\n"
|
||||||
|
|
@ -617,7 +617,7 @@ def group_subject_sort(subj)
|
||||||
@groups[subj]["messages"][i].dup,
|
@groups[subj]["messages"][i].dup,
|
||||||
@groups[subj]["ids"][i].dup,
|
@groups[subj]["ids"][i].dup,
|
||||||
@groups[subj]["servers"][i].dup
|
@groups[subj]["servers"][i].dup
|
||||||
] )
|
] ) if serverhash[@groups[subj]["servers"][i]] != nil
|
||||||
end
|
end
|
||||||
sort_arr.sort!{|a,b|
|
sort_arr.sort!{|a,b|
|
||||||
r = ward_sort(a[0], b[0])
|
r = ward_sort(a[0], b[0])
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue