Class: PagerDuty::CacheGlobalDowntime
- Inherits:
-
Object
- Object
- PagerDuty::CacheGlobalDowntime
- Includes:
- SentryLogging, Sidekiq::Job
- Defined in:
- app/sidekiq/pager_duty/cache_global_downtime.rb
Instance Method Summary collapse
Methods included from SentryLogging
#log_exception_to_sentry, #log_message_to_sentry, #non_nil_hash?, #normalize_level, #rails_logger, #set_sentry_metadata
Instance Method Details
#global_service_id ⇒ Object (private)
29 30 31 |
# File 'app/sidekiq/pager_duty/cache_global_downtime.rb', line 29 def global_service_id Settings.maintenance.services&.to_hash&.dig(:global) end |
#perform ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'app/sidekiq/pager_duty/cache_global_downtime.rb', line 12 def perform client = PagerDuty::MaintenanceClient.new = { 'service_ids' => [global_service_id] } maintenance_windows = client.get_all() file_path = 'tmp/maintenance_windows.json' File.open(file_path, 'w') do |f| f << maintenance_windows.to_json end PagerDuty::MaintenanceWindowsUploader.upload_file(file_path) rescue Common::Exceptions::BackendServiceException, Common::Client::Errors::ClientError => e log_exception_to_sentry(e) end |