fix a long standing bug & better house keeping
This commit is contained in:
parent
a339e931a9
commit
22b88262d0
2 changed files with 23 additions and 1 deletions
|
|
@ -907,7 +907,13 @@ def cache_save(cachedir, server)
|
||||||
file = File.new( "#{filename}.#{server}", "a+" ) or puts "couldn't open cachefile for writing"
|
file = File.new( "#{filename}.#{server}", "a+" ) or puts "couldn't open cachefile for writing"
|
||||||
# print "Updating cache...\n"
|
# print "Updating cache...\n"
|
||||||
@cache_buf[server].sort!
|
@cache_buf[server].sort!
|
||||||
file.print @cache_buf[server]
|
@cache_buf[server].each{|line|
|
||||||
|
begin
|
||||||
|
file.puts line
|
||||||
|
rescue Encoding::UndefinedConversionError
|
||||||
|
next
|
||||||
|
end
|
||||||
|
}
|
||||||
file.close
|
file.close
|
||||||
@cache_buf[server] = []
|
@cache_buf[server] = []
|
||||||
# print "Cache updated for #{server}\n"
|
# print "Cache updated for #{server}\n"
|
||||||
|
|
|
||||||
|
|
@ -446,6 +446,20 @@ def unlock
|
||||||
File.unlink(@config[group]["LOCKFILE"])
|
File.unlink(@config[group]["LOCKFILE"])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def cleantmp
|
||||||
|
puts "Removing old tmp files"
|
||||||
|
@config.each_key{ |group |
|
||||||
|
Dir.glob("#{@config[group]["TEMPDIR"]}/riptmp*"){ |file|
|
||||||
|
begin
|
||||||
|
File.delete(file)
|
||||||
|
rescue
|
||||||
|
puts "Couldn't remove #{file}"
|
||||||
|
next
|
||||||
|
end
|
||||||
|
}
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
def renice
|
def renice
|
||||||
group = @config.keys[0]
|
group = @config.keys[0]
|
||||||
if @config[group].has_key?("NICE")
|
if @config[group].has_key?("NICE")
|
||||||
|
|
@ -724,6 +738,8 @@ def startup
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cleantmp
|
||||||
|
|
||||||
@maxfilelength = get_max_file_length(@config[@config.keys[0]]["TEMPDIR"])
|
@maxfilelength = get_max_file_length(@config[@config.keys[0]]["TEMPDIR"])
|
||||||
|
|
||||||
# puts "\n$Id$"
|
# puts "\n$Id$"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue