increse timeouts for delayed job actions
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
class RelatedTagCalculator
|
||||
def self.find_tags(tag, limit)
|
||||
Post.tag_match(tag).limit(limit).select("posts.tag_string").reorder("posts.md5").map(&:tag_string)
|
||||
Post.with_timeout(10_000) do
|
||||
Post.tag_match(tag).limit(limit).select("posts.tag_string").reorder("posts.md5").map(&:tag_string)
|
||||
end
|
||||
end
|
||||
|
||||
def self.calculate_from_sample_to_array(tags, category_constraint = nil)
|
||||
|
||||
@@ -100,11 +100,13 @@ class Tag < ActiveRecord::Base
|
||||
Post.raw_tag_match(name).find_each do |post|
|
||||
post.reload
|
||||
post.set_tag_counts
|
||||
post.update_column(:tag_count, post.tag_count)
|
||||
post.update_column(:tag_count_general, post.tag_count_general)
|
||||
post.update_column(:tag_count_artist, post.tag_count_artist)
|
||||
post.update_column(:tag_count_copyright, post.tag_count_copyright)
|
||||
post.update_column(:tag_count_character, post.tag_count_character)
|
||||
Post.with_timeout(10_000, nil) do
|
||||
post.update_column(:tag_count, post.tag_count)
|
||||
post.update_column(:tag_count_general, post.tag_count_general)
|
||||
post.update_column(:tag_count_artist, post.tag_count_artist)
|
||||
post.update_column(:tag_count_copyright, post.tag_count_copyright)
|
||||
post.update_column(:tag_count_character, post.tag_count_character)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ module Danbooru
|
||||
connection.execute("SET STATEMENT_TIMEOUT = #{CurrentUser.user.statement_timeout}") unless Rails.env == "test"
|
||||
end
|
||||
|
||||
def with_timeout(n, default_value)
|
||||
def with_timeout(n, default_value = nil)
|
||||
connection.execute("SET STATEMENT_TIMEOUT = #{n}") unless Rails.env == "test"
|
||||
yield
|
||||
rescue ::ActiveRecord::StatementInvalid
|
||||
|
||||
Reference in New Issue
Block a user