From 08a72f849566ffd88af513778e44f3de32ceee1e Mon Sep 17 00:00:00 2001 From: albert Date: Tue, 19 Feb 2013 11:22:14 -0500 Subject: [PATCH] increase min expiry for related tag cache to 1 hour --- app/models/tag.rb | 4 +++- app/views/posts/partials/common/_secondary_links.html.erb | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/models/tag.rb b/app/models/tag.rb index 83480f5b9..a55b68b9e 100644 --- a/app/models/tag.rb +++ b/app/models/tag.rb @@ -347,13 +347,15 @@ class Tag < ActiveRecord::Base base = Math.sqrt([post_count, 0].max) if base > 24 24 + elsif base < 1 + 1 else base end end def should_update_related? - related_tags.blank? || related_tags_updated_at.blank? || related_tags_updated_at < related_cache_expiry.hours.ago + Delayed::Job.count < 200 && related_tags.blank? || related_tags_updated_at.blank? || related_tags_updated_at < related_cache_expiry.hours.ago end def related_tag_array diff --git a/app/views/posts/partials/common/_secondary_links.html.erb b/app/views/posts/partials/common/_secondary_links.html.erb index 67a1ebe3e..a997d4126 100644 --- a/app/views/posts/partials/common/_secondary_links.html.erb +++ b/app/views/posts/partials/common/_secondary_links.html.erb @@ -6,7 +6,7 @@
  • <%= link_to "Hot", posts_path(:tags => "order:rank") %>
  • <% unless CurrentUser.is_anonymous? %>
  • <%= link_to "Favorites", favorites_path %>
  • -
  • <%= link_to "Subscriptions", posts_tag_subscription_path(CurrentUser.id) %>
  • +
  • <%= link_to "Subscriptions", posts_path(:tags => "sub:#{CurrentUser.name}") %>
  • <% end %>
  • <%= link_to "Changes", post_versions_path %>
  • <% if CurrentUser.is_janitor? %>