From 21df0cfd8515b50224eca9a8af16b04eab73b276 Mon Sep 17 00:00:00 2001 From: csouriss Date: Sat, 4 Apr 2020 12:21:50 +0200 Subject: [PATCH] Fix #715 by correcting misuse of ActiveRecord API for GitCache objects This caused frequent 404 errors on the "Repository" view whenever GitCache needed to be purged. --- lib/redmine_git_hosting/cache/database.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/redmine_git_hosting/cache/database.rb b/lib/redmine_git_hosting/cache/database.rb index 4dda704f744..db74308477c 100644 --- a/lib/redmine_git_hosting/cache/database.rb +++ b/lib/redmine_git_hosting/cache/database.rb @@ -47,7 +47,7 @@ def clear_cache_for_repository(repo_id) end def apply_cache_limit - GitCache.find(:last, order: 'created_at DESC').destroy if max_cache_elements >= 0 && GitCache.count > max_cache_elements + GitCache.order(:created_at).first.destroy if max_cache_elements >= 0 && GitCache.count > max_cache_elements end end end