- 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:
Ward Wouts 2003-08-31 20:08:14 +00:00
parent 45c50b1c7c
commit 20d7b4ff26

View file

@ -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$
#
@ -563,17 +563,17 @@ def save_cache(cachedir, server)
if FileTest.directory?( cachedir )
file = File.new( "#{filename}.#{server}.new", "w" ) or print "couldn't open cachefile for writing\n"
print "Updating cache...\n"
# cache = []
# for i in (0...@subjects.length)
# cache.push("#{@ids[i]}|#{@messids[i]}|#{@servers[i]}|#{@subjects[i]}\n")
# end
# cache.sort!
# file.print cache
cache = []
for i in (0...@subjects.length)
if @servers[i] == server
file.print "#{@ids[i]}|#{@messids[i]}|#{@subjects[i]}\n"
end
cache.push("#{@ids[i]}|#{@messids[i]}|#{@subjects[i]}\n") if @servers[i] == server
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
if ( File.move("#{filename}.#{server}.new", "#{filename}.#{server}") )
print "Cache updated for #{server}\n"
@ -617,7 +617,7 @@ def group_subject_sort(subj)
@groups[subj]["messages"][i].dup,
@groups[subj]["ids"][i].dup,
@groups[subj]["servers"][i].dup
] )
] ) if serverhash[@groups[subj]["servers"][i]] != nil
end
sort_arr.sort!{|a,b|
r = ward_sort(a[0], b[0])