Module: Sidekiq::Util
- Included in:
- CLI, Fetcher, Manager, Middleware::Server::ExceptionHandler, Middleware::Server::RetryJobs, Processor, Retry::Poller
- Defined in:
- lib/sidekiq/util.rb
Overview
This module is part of Sidekiq core and not intended for extensions.
Constant Summary collapse
- EXPIRY =
60 * 60
Instance Method Summary collapse
- #constantize(camel_cased_word) ⇒ Object
- #logger ⇒ Object
- #process_id ⇒ Object
- #redis(&block) ⇒ Object
- #watchdog(last_words) ⇒ Object
Instance Method Details
#constantize(camel_cased_word) ⇒ Object
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/sidekiq/util.rb', line 9 def constantize(camel_cased_word) names = camel_cased_word.split('::') names.shift if names.empty? || names.first.empty? constant = Object names.each do |name| constant = constant.const_defined?(name) ? constant.const_get(name) : constant.const_missing(name) end constant end |
#process_id ⇒ Object
36 37 38 |
# File 'lib/sidekiq/util.rb', line 36 def process_id Process.pid end |
#redis(&block) ⇒ Object
32 33 34 |
# File 'lib/sidekiq/util.rb', line 32 def redis(&block) Sidekiq.redis(&block) end |
#watchdog(last_words) ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/sidekiq/util.rb', line 20 def watchdog(last_words) yield rescue => ex logger.error last_words logger.error ex logger.error ex.backtrace.join("\n") end |