Skip to content

Commit

Permalink
add project analysis asynchronous job
Browse files Browse the repository at this point in the history
  • Loading branch information
divideby0 committed Nov 1, 2024
1 parent b9a85f0 commit 27d8fba
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
7 changes: 7 additions & 0 deletions app/jobs/application_job.rb
Original file line number Diff line number Diff line change
@@ -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
9 changes: 9 additions & 0 deletions app/jobs/project_analysis_job.rb
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 27d8fba

Please sign in to comment.