module Sidekiq::WebCustom::Timeout

Constants

DEFAULT_EXCEPTION
PROC

Public Instance Methods

timeout(warn:, timeout:, proc: ->(_, _) {} click to toggle source
# File lib/sidekiq/web_custom/timeout.rb, line 55
def timeout(warn:, timeout:, proc: ->(_, _) {}, exception: DEFAULT_EXCEPTION, message: nil, debug: false, &block)
  raise Sidekiq::WebCustom::ArgumentError, 'Block not given' unless block_given?

  puts "at: timeout; valid bock given" if debug
  message ||= "Execution exceeded #{timeout} seconds." if debug
  PROC.call(warn, timeout, proc, exception, message, debug, &block)
end