when PostKeeperManager.check_and_update fails, retry (fixes #3699)
This commit is contained in:
@@ -17,6 +17,9 @@ class PostKeeperManager
|
||||
def self.check_and_update(post, updater_id = nil, increment_tags = nil)
|
||||
check_and_assign(post, updater_id, increment_tags)
|
||||
post.update_column(:keeper_data, post.keeper_data)
|
||||
rescue ActiveRecord::StatementInvalid => e
|
||||
PostArchive.check_for_retry(e.message)
|
||||
raise
|
||||
end
|
||||
|
||||
def self.check_and_assign(post, updater_id = nil, increment_tags = nil)
|
||||
|
||||
@@ -11,6 +11,12 @@ class PostArchive < ApplicationRecord
|
||||
establish_connection (ENV["ARCHIVE_DATABASE_URL"] || "archive_#{Rails.env}".to_sym) if enabled?
|
||||
self.table_name = "post_versions"
|
||||
|
||||
def self.check_for_retry(msg)
|
||||
if msg =~ /can't get socket descriptor/ && msg =~ /post_versions/
|
||||
connection.reconnect!
|
||||
end
|
||||
end
|
||||
|
||||
module SearchMethods
|
||||
def for_user(user_id)
|
||||
if user_id
|
||||
|
||||
Reference in New Issue
Block a user