aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Legler <alex@a3li.li>2016-08-10 12:57:20 +0200
committerAlex Legler <alex@a3li.li>2016-08-10 12:57:20 +0200
commit29e0977d7c31291e0c6382171adce91e465ac3bf (patch)
treea72244128132b6c205715cac3024ca215512ee0f
parentDon't cache package header (diff)
downloadpackages-29e0977d7c31291e0c6382171adce91e465ac3bf.tar.gz
packages-29e0977d7c31291e0c6382171adce91e465ac3bf.tar.bz2
packages-29e0977d7c31291e0c6382171adce91e465ac3bf.zip
Manually expire changelog cache
This should hopefully relieve the load the repeated `git log' calls cause.
-rw-r--r--app/controllers/packages_controller.rb2
-rw-r--r--lib/kkuleomi/store/models/package_import.rb2
-rw-r--r--lib/kkuleomi/store/models/version_import.rb1
3 files changed, 4 insertions, 1 deletions
diff --git a/app/controllers/packages_controller.rb b/app/controllers/packages_controller.rb
index ee098ae..a972fcd 100644
--- a/app/controllers/packages_controller.rb
+++ b/app/controllers/packages_controller.rb
@@ -35,7 +35,7 @@ class PackagesController < ApplicationController
@package = Package.find_by(:atom, params[:id])
fail ActionController::RoutingError, 'No such package' unless @package
- @changelog = Rails.cache.fetch("changelog/#{@package.atom}", expires_in: 10.minutes) do
+ @changelog = Rails.cache.fetch("changelog/#{@package.atom}") do
Portage::Util::History.for(@package.category, @package.name, 5)
end
diff --git a/lib/kkuleomi/store/models/package_import.rb b/lib/kkuleomi/store/models/package_import.rb
index caea415..3b12d8a 100644
--- a/lib/kkuleomi/store/models/package_import.rb
+++ b/lib/kkuleomi/store/models/package_import.rb
@@ -47,6 +47,8 @@ module Kkuleomi::Store::Models::PackageImport
package: name
)
end
+
+ Rails.cache.delete("changelog/#{package_model.to_cp}")
end
def set_basic_metadata(package_model, latest_ebuild)
diff --git a/lib/kkuleomi/store/models/version_import.rb b/lib/kkuleomi/store/models/version_import.rb
index c18344e..b4e4caf 100644
--- a/lib/kkuleomi/store/models/version_import.rb
+++ b/lib/kkuleomi/store/models/version_import.rb
@@ -50,6 +50,7 @@ module Kkuleomi::Store::Models::VersionImport
) if options[:package_state] != 'new' && options[:version_state] == 'new'
process_keyword_diff(old_keywords, keywords, parent_package) unless old_keywords == keywords
+ Rails.cache.delete("changelog/#{parent_package.atom}")
end
end