2025-05-29 17:28:06 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Jobs
|
|
|
|
class PostLocalizationBackfill < ::Jobs::Scheduled
|
|
|
|
every 5.minutes
|
|
|
|
cluster_concurrency 1
|
|
|
|
|
|
|
|
def execute(args)
|
2025-07-09 22:21:51 +08:00
|
|
|
return if !DiscourseAi::Translation.backfill_enabled?
|
2025-05-29 17:28:06 +08:00
|
|
|
|
2025-06-21 15:45:09 +08:00
|
|
|
limit = SiteSetting.ai_translation_backfill_hourly_rate / (60 / 5) # this job runs in 5-minute intervals
|
|
|
|
return if limit == 0
|
2025-05-29 17:28:06 +08:00
|
|
|
|
2025-06-21 15:45:09 +08:00
|
|
|
Jobs.enqueue(:localize_posts, limit:)
|
2025-05-29 17:28:06 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|