1
0
Fork 0
mirror of https://github.com/mperham/sidekiq.git synced 2022-11-09 13:52:34 -05:00
mperham--sidekiq/lib/sidekiq/util.rb

38 lines
628 B
Ruby
Raw Normal View History

2012-09-16 10:28:25 -04:00
require 'socket'
require 'sidekiq/exception_handler'
require 'sidekiq/core_ext'
2012-01-22 14:32:38 -05:00
module Sidekiq
2012-02-17 16:39:36 -05:00
##
# This module is part of Sidekiq core and not intended for extensions.
#
2012-01-22 14:32:38 -05:00
module Util
include ExceptionHandler
2012-01-22 14:32:38 -05:00
2012-09-08 22:50:03 -04:00
EXPIRY = 60 * 60 * 24
2012-01-22 14:32:38 -05:00
def watchdog(last_words)
yield
2012-08-29 23:20:20 -04:00
rescue Exception => ex
handle_exception(ex, { :context => last_words })
raise ex
2012-01-22 14:32:38 -05:00
end
def logger
Sidekiq.logger
2012-01-22 19:01:46 -05:00
end
def redis(&block)
Sidekiq.redis(&block)
end
def process_id
@@process_id ||= SecureRandom.hex
end
2012-09-16 10:27:49 -04:00
def hostname
Socket.gethostname
end
2012-01-22 14:32:38 -05:00
end
end