Skip to content

Commit

Permalink
Skip recently fresh files because of zypper TTL
Browse files Browse the repository at this point in the history
  • Loading branch information
ikapelyukhin committed Dec 10, 2020
1 parent cbdf29a commit 459b5c9
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions clean_outdated.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 459b5c9

Please sign in to comment.