mirror of
https://github.com/discourse/discourse-ai.git
synced 2025-09-08 20:50:38 +00:00
* DEV: Indicate backfill rate for translations is hourly * add ai_translation_max_post_length * default value update
20 lines
543 B
Ruby
20 lines
543 B
Ruby
# frozen_string_literal: true
|
|
|
|
module Jobs
|
|
class PostLocalizationBackfill < ::Jobs::Scheduled
|
|
every 5.minutes
|
|
cluster_concurrency 1
|
|
|
|
def execute(args)
|
|
return if !SiteSetting.discourse_ai_enabled
|
|
return if !SiteSetting.ai_translation_enabled
|
|
|
|
return if SiteSetting.content_localization_supported_locales.blank?
|
|
limit = SiteSetting.ai_translation_backfill_hourly_rate / (60 / 5) # this job runs in 5-minute intervals
|
|
return if limit == 0
|
|
|
|
Jobs.enqueue(:localize_posts, limit:)
|
|
end
|
|
end
|
|
end
|