diff --git a/app/jobs/application_job.rb b/app/jobs/application_job.rb new file mode 100644 index 00000000..d394c3d1 --- /dev/null +++ b/app/jobs/application_job.rb @@ -0,0 +1,7 @@ +class ApplicationJob < ActiveJob::Base + # Automatically retry jobs that encountered a deadlock + # retry_on ActiveRecord::Deadlocked + + # Most jobs are safe to ignore if the underlying records are no longer available + # discard_on ActiveJob::DeserializationError +end diff --git a/app/jobs/project_analysis_job.rb b/app/jobs/project_analysis_job.rb new file mode 100644 index 00000000..3e7b7874 --- /dev/null +++ b/app/jobs/project_analysis_job.rb @@ -0,0 +1,9 @@ +class ProjectAnalysisJob < ApplicationJob + queue_as :default + + def perform(project_id) + ProjectAnalysisGenerator.new(project_id).call + rescue => e + Rails.logger.error("Failed to generate project analysis for Project #{project_id}: #{e.message}") + end +end