From 24ac738af0c616a22726e79bb243ea1fed8c2794 Mon Sep 17 00:00:00 2001 From: Thomas Birke Date: Fri, 28 Aug 2026 23:15:24 +0200 Subject: [PATCH] Fix cron job base class and migration version number - ClearOldGiteaPullRequestsJob: inherit from ApplicationJob (not CronJob) and use find_each(&:destroy!) to match the GitHub/GitLab pattern - Rename aggregated migration from 1016015 to 1023015 to avoid collision with the recaptcha module migration --- app/workers/cron/clear_old_gitea_pull_requests_job.rb | 7 ++++--- ...igrations.rb => 1023015_aggregated_gitea_migrations.rb} | 0 2 files changed, 4 insertions(+), 3 deletions(-) rename db/migrate/{1016015_aggregated_gitea_migrations.rb => 1023015_aggregated_gitea_migrations.rb} (100%) diff --git a/app/workers/cron/clear_old_gitea_pull_requests_job.rb b/app/workers/cron/clear_old_gitea_pull_requests_job.rb index 413135b..13a4085 100644 --- a/app/workers/cron/clear_old_gitea_pull_requests_job.rb +++ b/app/workers/cron/clear_old_gitea_pull_requests_job.rb @@ -29,11 +29,12 @@ #++ module Cron - class ClearOldGiteaPullRequestsJob < CronJob - self.cron_expression = "25 1 * * *" + class ClearOldGiteaPullRequestsJob < ApplicationJob + priority_number :low def perform - GiteaPullRequest.without_work_package.destroy_all + GiteaPullRequest.without_work_package + .find_each(&:destroy!) end end end diff --git a/db/migrate/1016015_aggregated_gitea_migrations.rb b/db/migrate/1023015_aggregated_gitea_migrations.rb similarity index 100% rename from db/migrate/1016015_aggregated_gitea_migrations.rb rename to db/migrate/1023015_aggregated_gitea_migrations.rb