Class: SidekiqUniqueJobs::Orphans::Observer

Inherits:
Object
  • Object
show all
Includes:
Logging
Defined in:
lib/sidekiq_unique_jobs/orphans/observer.rb

Overview

Observes the Orphan::Manager and provides information about each execution

Author:

Instance Method Summary collapse

Methods included from Logging

#build_message, included, #log_debug, #log_error, #log_fatal, #log_info, #log_warn, #logger, #logging_context, #with_configured_loggers_context, #with_logging_context

Instance Method Details

#update(time, result, ex) ⇒ <type>

Runs every time the Manager executes the TimerTask

used for logging information about the reaping

Parameters:

  • time (Time)

    the time of the execution

  • result (Object)

    the result of the execution

  • ex (Exception)

    any error raised from the TimerTask

Returns:

  • (<type>)

    <description>



30
31
32
33
34
35
36
37
38
39
# File 'lib/sidekiq_unique_jobs/orphans/observer.rb', line 30

def update(time, result, ex)
  if result
    log_info("(#{time}) Execution successfully returned #{result}")
  elsif ex.is_a?(Concurrent::TimeoutError)
    log_warn("(#{time}) Execution timed out")
  else
    log_info("(#{time}) Cleanup failed with error #{ex.message}")
    log_error(ex)
  end
end