OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
[62479] Fix migration job not properly retried
Christophe Bliard76c0fa9794de
diff --git a/config/initializers/retry_failed_jobs_with_name_error.rb b/config/initializers/retry_failed_jobs_with_name_error.rbindex 0efa810509a..add24ea1a17 100644--- a/config/initializers/retry_failed_jobs_with_name_error.rb+++ b/config/initializers/retry_failed_jobs_with_name_error.rb@@ -30,7 +30,7 @@Rails.application.configure doconfig.after_initialize do- # Retry jobs that failed with "NameError: uninitialized constant ...Job" as+ # Retry jobs that failed with "NameError: uninitialized constant ..." as# the worker may have failed to load it because the job class did not exist# at the time of execution. This can happen on upgrades when the worker is# still running the previous version while a migration is enqueuing jobs defined@@ -42,8 +42,15 @@ Rails.application.configure doGoodJob::Job.discarded- .where("error LIKE ?", "NameError: uninitialized constant %Job")- .find_each do |job|+ .where("error LIKE ?", "NameError: uninitialized constant %")+ .filter do |job|+ # Only retry jobs with NameError related to the job class name.+ # For instance, error is "NameError: uninitialized constant WorkPackages::AutomaticMode"+ # and the job class name is "WorkPackages::AutomaticMode::MigrateValuesJob".+ name = job.error.delete_prefix("NameError: uninitialized constant ")+ job.job_class.include?(name)+ end # rubocop:disable Style/MultilineBlockChain+ .each do |job|job.retry_jobRails.logger.info("Successfully enqueued job for retry #{job.display_name} (job id: #{job.id})")rescue StandardError => e