FIX: Hijack controller for topic move posts (#31029)

We have had reports of the topic post move endpoint
sometimes timing out, not necessarily with a large
number of posts, but between two topics that have a
large number of posts.

This buys us some time by `hijack`ing the controller,
which gives us 90 seconds instead of the Unicorn 30
seconds to do the work. At some point we may want to
do this in a background job.

c.f.
https://meta.discourse.org/t/moving-posts-to-a-long-topic-fails/347984
This commit is contained in:
Martin Brennan 2025-01-28 16:27:30 +10:00 committed by GitHub
parent a2db9f959a
commit ed316b40a4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -914,10 +914,12 @@ class TopicsController < ApplicationController
end end
end end
destination_topic = move_posts_to_destination(topic) hijack do
render_topic_changes(destination_topic) destination_topic = move_posts_to_destination(topic)
rescue ActiveRecord::RecordInvalid, ActiveRecord::RecordNotSaved => ex render_topic_changes(destination_topic)
render_json_error(ex) rescue ActiveRecord::RecordInvalid, ActiveRecord::RecordNotSaved => ex
render_json_error(ex)
end
end end
def change_post_owners def change_post_owners