diff --git a/app/logical/post_sets/post.rb b/app/logical/post_sets/post.rb index e463bd33f..245cf7da8 100644 --- a/app/logical/post_sets/post.rb +++ b/app/logical/post_sets/post.rb @@ -45,7 +45,7 @@ module PostSets timeout = 3000 if tag_array.any? {|x| x =~ /^source:.*\*.*pixiv/} - timeout = 300 + timeout = 1000 end @posts ||= begin diff --git a/app/models/tag.rb b/app/models/tag.rb index 4f62cfcd5..884463860 100644 --- a/app/models/tag.rb +++ b/app/models/tag.rb @@ -369,28 +369,24 @@ class Tag < ActiveRecord::Base end def update_related_if_outdated - if should_update_related? - if post_count < 100 - update_related - else - delay(:queue => "default").update_related - end + if should_update_related? && Delayed::Job.count < 200 + delay(:queue => "default").update_related end end def related_cache_expiry base = Math.sqrt([post_count, 0].max) - if base > 24 + if base > 24 * 7 + 24 * 7 + elsif base < 24 24 - elsif base < 1 - 1 else base end end def should_update_related? - Delayed::Job.count < 200 && (related_tags.blank? || related_tags_updated_at.blank? || related_tags_updated_at < related_cache_expiry.hours.ago) + 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/show/_share.html.erb b/app/views/posts/partials/show/_share.html.erb index 019154b3a..53afa9930 100644 --- a/app/views/posts/partials/show/_share.html.erb +++ b/app/views/posts/partials/show/_share.html.erb @@ -14,7 +14,7 @@ "title": "<%= j post.presenter.humanized_essential_tag_string %>" }; - +