diff --git a/clean_outdated.rb b/clean_outdated.rb index 79bda1b..6dab0ab 100755 --- a/clean_outdated.rb +++ b/clean_outdated.rb @@ -56,6 +56,11 @@ def start @packages.keys.each do |file| next if File.directory?(file) + + # skipping files that are younger than 2 days, zypper service has a TTL of 1 day during which it uses cached metadata + file_age = Time.now() - File.mtime(file) + next if file_age < 48*60*60 + outdated_size += get_size(file) outdated_files += 1 File.delete(file)