aliases/implications: don't retry if approving fails.
This was originally meant to deal with statement timeouts when updating tags. This is no longer a problem.
This commit is contained in:
@@ -53,33 +53,23 @@ class TagAlias < TagRelationship
|
|||||||
raise errors.full_messages.join("; ")
|
raise errors.full_messages.join("; ")
|
||||||
end
|
end
|
||||||
|
|
||||||
tries = 0
|
CurrentUser.scoped(User.system) do
|
||||||
|
update!(status: "processing")
|
||||||
begin
|
move_aliases_and_implications
|
||||||
CurrentUser.scoped(User.system) do
|
move_saved_searches
|
||||||
update!(status: "processing")
|
ensure_category_consistency
|
||||||
move_aliases_and_implications
|
update_posts
|
||||||
move_saved_searches
|
forum_updater.update(approval_message(approver), "APPROVED") if update_topic
|
||||||
ensure_category_consistency
|
rename_wiki_and_artist
|
||||||
update_posts
|
update!(status: "active")
|
||||||
forum_updater.update(approval_message(approver), "APPROVED") if update_topic
|
|
||||||
rename_wiki_and_artist
|
|
||||||
update!(status: "active")
|
|
||||||
end
|
|
||||||
rescue Exception => e
|
|
||||||
if tries < 5
|
|
||||||
tries += 1
|
|
||||||
sleep 2**tries
|
|
||||||
retry
|
|
||||||
end
|
|
||||||
|
|
||||||
CurrentUser.scoped(approver) do
|
|
||||||
forum_updater.update(failure_message(e), "FAILED") if update_topic
|
|
||||||
update(status: "error: #{e}")
|
|
||||||
end
|
|
||||||
|
|
||||||
DanbooruLogger.log(e, tag_alias_id: id, antecedent_name: antecedent_name, consequent_name: consequent_name)
|
|
||||||
end
|
end
|
||||||
|
rescue Exception => e
|
||||||
|
CurrentUser.scoped(approver) do
|
||||||
|
forum_updater.update(failure_message(e), "FAILED") if update_topic
|
||||||
|
update(status: "error: #{e}")
|
||||||
|
end
|
||||||
|
|
||||||
|
DanbooruLogger.log(e, tag_alias_id: id, antecedent_name: antecedent_name, consequent_name: consequent_name)
|
||||||
end
|
end
|
||||||
|
|
||||||
def absence_of_transitive_relation
|
def absence_of_transitive_relation
|
||||||
|
|||||||
@@ -131,28 +131,18 @@ class TagImplication < TagRelationship
|
|||||||
raise errors.full_messages.join("; ")
|
raise errors.full_messages.join("; ")
|
||||||
end
|
end
|
||||||
|
|
||||||
tries = 0
|
CurrentUser.scoped(User.system) do
|
||||||
|
update(status: "processing")
|
||||||
begin
|
update_posts
|
||||||
CurrentUser.scoped(User.system) do
|
update(status: "active")
|
||||||
update(status: "processing")
|
update_descendant_names_for_parents
|
||||||
update_posts
|
forum_updater.update(approval_message(approver), "APPROVED") if update_topic
|
||||||
update(status: "active")
|
|
||||||
update_descendant_names_for_parents
|
|
||||||
forum_updater.update(approval_message(approver), "APPROVED") if update_topic
|
|
||||||
end
|
|
||||||
rescue Exception => e
|
|
||||||
if tries < 5
|
|
||||||
tries += 1
|
|
||||||
sleep 2**tries
|
|
||||||
retry
|
|
||||||
end
|
|
||||||
|
|
||||||
forum_updater.update(failure_message(e), "FAILED") if update_topic
|
|
||||||
update(status: "error: #{e}")
|
|
||||||
|
|
||||||
DanbooruLogger.log(e, tag_implication_id: id, antecedent_name: antecedent_name, consequent_name: consequent_name)
|
|
||||||
end
|
end
|
||||||
|
rescue Exception => e
|
||||||
|
forum_updater.update(failure_message(e), "FAILED") if update_topic
|
||||||
|
update(status: "error: #{e}")
|
||||||
|
|
||||||
|
DanbooruLogger.log(e, tag_implication_id: id, antecedent_name: antecedent_name, consequent_name: consequent_name)
|
||||||
end
|
end
|
||||||
|
|
||||||
def approve!(approver: CurrentUser.user, update_topic: true)
|
def approve!(approver: CurrentUser.user, update_topic: true)
|
||||||
|
|||||||
Reference in New Issue
Block a user