Sha256: 2fc36a4f51680570ac4d7d6e8d2d6772bb6015c7b98e81d2eb96975de47e876f

Contents?: true

Size: 613 Bytes

Versions: 4

Compression:

Stored size: 613 Bytes

Contents

require 'socket'
require 'sidekiq/exception_handler'
require 'sidekiq/core_ext'

module Sidekiq
  ##
  # This module is part of Sidekiq core and not intended for extensions.
  #
  module Util
    include ExceptionHandler

    EXPIRY = 60 * 60 * 24

    def watchdog(last_words)
      yield
    rescue Exception => ex
      handle_exception(ex, { :context => last_words })
    end

    def logger
      Sidekiq.logger
    end

    def redis(&block)
      Sidekiq.redis(&block)
    end

    def process_id
      @@process_id ||= SecureRandom.hex
    end

    def hostname
      Socket.gethostname
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
sidekiq-2.14.1 lib/sidekiq/util.rb
sidekiq-2.14.0 lib/sidekiq/util.rb
sidekiq-2.13.1 lib/sidekiq/util.rb
sidekiq-2.13.0 lib/sidekiq/util.rb