Class: PgInsights::RecurringHealthChecksJob
- Inherits:
-
ApplicationJob
- Object
- ActiveJob::Base
- ApplicationJob
- PgInsights::RecurringHealthChecksJob
- Defined in:
- app/jobs/pg_insights/recurring_health_checks_job.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.should_be_scheduled? ⇒ Boolean
24 25 26 27 28 29 |
# File 'app/jobs/pg_insights/recurring_health_checks_job.rb', line 24 def self.should_be_scheduled? PgInsights.background_jobs_available? && PgInsights.enable_background_jobs && defined?(HealthCheckSchedulerJob) && defined?(HealthCheckJob) end |
.validate_setup ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'app/jobs/pg_insights/recurring_health_checks_job.rb', line 31 def self.validate_setup issues = [] issues << "Background jobs are disabled" unless PgInsights.enable_background_jobs issues << "ActiveJob not available" unless defined?(ActiveJob::Base) issues << "Queue adapter is inline (no async processing)" if ActiveJob::Base.queue_adapter.is_a?(ActiveJob::QueueAdapters::InlineAdapter) issues << "HealthCheckJob not available" unless defined?(HealthCheckJob) issues << "HealthCheckSchedulerJob not available" unless defined?(HealthCheckSchedulerJob) if issues.empty? { valid: true, message: "PgInsights recurring health checks are properly configured" } else { valid: false, issues: issues } end end |
Instance Method Details
#perform ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'app/jobs/pg_insights/recurring_health_checks_job.rb', line 9 def perform unless PgInsights.background_jobs_available? Rails.logger.warn "PgInsights: Background jobs not available, skipping recurring health checks" return end Rails.logger.debug "PgInsights: Starting recurring health check cycle" if HealthCheckSchedulerJob.schedule_health_checks Rails.logger.info "PgInsights: Recurring health check cycle initiated successfully" else Rails.logger.warn "PgInsights: Recurring health check cycle failed to start" end end |