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:
evazion
2020-02-22 01:19:07 -06:00
parent d915009407
commit ca1492c8ca
2 changed files with 27 additions and 47 deletions

View File

@@ -53,9 +53,6 @@ class TagAlias < TagRelationship
raise errors.full_messages.join("; ") raise errors.full_messages.join("; ")
end end
tries = 0
begin
CurrentUser.scoped(User.system) do CurrentUser.scoped(User.system) do
update!(status: "processing") update!(status: "processing")
move_aliases_and_implications move_aliases_and_implications
@@ -67,12 +64,6 @@ class TagAlias < TagRelationship
update!(status: "active") update!(status: "active")
end end
rescue Exception => e rescue Exception => e
if tries < 5
tries += 1
sleep 2**tries
retry
end
CurrentUser.scoped(approver) do CurrentUser.scoped(approver) do
forum_updater.update(failure_message(e), "FAILED") if update_topic forum_updater.update(failure_message(e), "FAILED") if update_topic
update(status: "error: #{e}") update(status: "error: #{e}")
@@ -80,7 +71,6 @@ class TagAlias < TagRelationship
DanbooruLogger.log(e, tag_alias_id: id, antecedent_name: antecedent_name, consequent_name: consequent_name) DanbooruLogger.log(e, tag_alias_id: id, antecedent_name: antecedent_name, consequent_name: consequent_name)
end end
end
def absence_of_transitive_relation def absence_of_transitive_relation
return if is_rejected? return if is_rejected?

View File

@@ -131,9 +131,6 @@ class TagImplication < TagRelationship
raise errors.full_messages.join("; ") raise errors.full_messages.join("; ")
end end
tries = 0
begin
CurrentUser.scoped(User.system) do CurrentUser.scoped(User.system) do
update(status: "processing") update(status: "processing")
update_posts update_posts
@@ -142,18 +139,11 @@ class TagImplication < TagRelationship
forum_updater.update(approval_message(approver), "APPROVED") if update_topic forum_updater.update(approval_message(approver), "APPROVED") if update_topic
end end
rescue Exception => e rescue Exception => e
if tries < 5
tries += 1
sleep 2**tries
retry
end
forum_updater.update(failure_message(e), "FAILED") if update_topic forum_updater.update(failure_message(e), "FAILED") if update_topic
update(status: "error: #{e}") update(status: "error: #{e}")
DanbooruLogger.log(e, tag_implication_id: id, antecedent_name: antecedent_name, consequent_name: consequent_name) DanbooruLogger.log(e, tag_implication_id: id, antecedent_name: antecedent_name, consequent_name: consequent_name)
end end
end
def approve!(approver: CurrentUser.user, update_topic: true) def approve!(approver: CurrentUser.user, update_topic: true)
update(approver: approver, status: "queued") update(approver: approver, status: "queued")