diff --git a/app/jobs/regular/detect_translate_post.rb b/app/jobs/regular/detect_translate_post.rb index f6358026f..479444ae0 100644 --- a/app/jobs/regular/detect_translate_post.rb +++ b/app/jobs/regular/detect_translate_post.rb @@ -2,6 +2,7 @@ module Jobs class DetectTranslatePost < ::Jobs::Base + cluster_concurrency 1 sidekiq_options retry: false def execute(args) diff --git a/app/jobs/regular/detect_translate_topic.rb b/app/jobs/regular/detect_translate_topic.rb index cd507e9ce..29b030ae2 100644 --- a/app/jobs/regular/detect_translate_topic.rb +++ b/app/jobs/regular/detect_translate_topic.rb @@ -2,6 +2,7 @@ module Jobs class DetectTranslateTopic < ::Jobs::Base + cluster_concurrency 1 sidekiq_options retry: false def execute(args) diff --git a/lib/translation/entry_point.rb b/lib/translation/entry_point.rb index 7d9f1bbc6..418fe3d6a 100644 --- a/lib/translation/entry_point.rb +++ b/lib/translation/entry_point.rb @@ -4,7 +4,7 @@ module DiscourseAi module Translation class EntryPoint def inject_into(plugin) - plugin.on(:post_process_cooked) do |_, post| + plugin.on(:post_created) do |post| if SiteSetting.discourse_ai_enabled && SiteSetting.ai_translation_enabled Jobs.enqueue(:detect_translate_post, post_id: post.id) end diff --git a/spec/lib/translation/entry_point_spec.rb b/spec/lib/translation/entry_point_spec.rb index e76e8df5a..ba2c76045 100644 --- a/spec/lib/translation/entry_point_spec.rb +++ b/spec/lib/translation/entry_point_spec.rb @@ -11,9 +11,8 @@ describe "upon post process cooked" do it "enqueues detect post locale and translate post job" do - post = Fabricate(:post) - CookedPostProcessor.new(post).post_process - + post = + PostCreator.create!(Fabricate(:user), raw: "post", title: "topic", skip_validations: true) expect_job_enqueued(job: :detect_translate_post, args: { post_id: post.id }) end