BURs: update posts in parallel.

When processing an alias, rename, implication, mass update, or nuke,
update the posts in parallel. This means that if we alias foo to bar,
for example, then we use four processes at once to retag the posts from
foo to bar.

This doesn't mean that if we have two aliases in a BUR, we process both
aliases in parallel. It simply means that when processing an alias, we
update the posts in parallel for that alias.
This commit is contained in:
evazion
2021-09-19 22:30:54 -05:00
parent 21f0c2acc3
commit d854bf6b53
10 changed files with 99 additions and 32 deletions

View File

@@ -266,6 +266,7 @@ class BulkUpdateRequestTest < ActiveSupport::TestCase
should "update the tags" do
assert_equal("bar", @post.reload.tag_string)
assert_equal("approved", @bur.reload.status)
assert_equal(User.system, @post.versions.last.updater)
end
should "be case-sensitive" do
@@ -288,6 +289,7 @@ class BulkUpdateRequestTest < ActiveSupport::TestCase
should "rename the tags" do
assert_equal("bar blah", @post.reload.tag_string)
assert_equal("approved", @bur.reload.status)
assert_equal(User.system, @post.versions.last.updater)
end
should "move the tag's artist entry and wiki page" do
@@ -351,6 +353,7 @@ class BulkUpdateRequestTest < ActiveSupport::TestCase
assert_equal("foo", @post.reload.tag_string)
assert_equal("approved", @bur.reload.status)
assert_equal(User.system, @post.versions.last.updater)
end
should "remove implications" do
@@ -370,6 +373,7 @@ class BulkUpdateRequestTest < ActiveSupport::TestCase
assert_equal([], @pool.post_ids)
assert_equal("approved", @bur.reload.status)
assert_equal(User.system, @pool.versions.last.updater)
end
end
@@ -514,6 +518,10 @@ class BulkUpdateRequestTest < ActiveSupport::TestCase
assert_equal("approved", @bur.reload.status)
end
should "update the post as DanbooruBot" do
assert_equal(User.system, @post.versions.last.updater)
end
should "set the BUR as failed if there is an unexpected error during processing" do
@bur = create(:bulk_update_request, script: "alias one -> two")
TagAlias.any_instance.stubs(:process!).raises(RuntimeError.new("oh no"))