Class: RailsErrorDashboard::AsyncErrorLoggingJob
- Inherits:
-
ApplicationJob
- Object
- ActiveJob::Base
- ApplicationJob
- RailsErrorDashboard::AsyncErrorLoggingJob
- Defined in:
- app/jobs/rails_error_dashboard/async_error_logging_job.rb
Overview
Background job for asynchronous error logging This prevents error logging from blocking the main request/response cycle
Instance Method Summary collapse
-
#perform(exception_data, context) ⇒ Object
Performs async error logging.
Instance Method Details
#perform(exception_data, context) ⇒ Object
Performs async error logging
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'app/jobs/rails_error_dashboard/async_error_logging_job.rb', line 12 def perform(exception_data, context) # Reconstruct the exception from serialized data exception = reconstruct_exception(exception_data) # Log the error synchronously in the background job # Call .new().call to bypass async check (we're already async) Commands::LogError.new(exception, context).call rescue => e # Don't let async job errors break the job queue Rails.logger.error("AsyncErrorLoggingJob failed: #{e.}") Rails.logger.error("Backtrace: #{e.backtrace&.first(5)&.join("\n")}") end |