module Qless

The top level container for all things qless

The top level container for all things qless

Constants

Error

Define our error base class before requiring the other files so they can define subclasses.

InvalidTimeoutError
JobTimedoutError

Unique error class used when a job is timed out by this middleware. Allows us to differentiate this timeout from others caused by `::Timeout::Error`

LuaScriptError
USING_LEGACY_REDIS_VERSION

to maintain backwards compatibility with v2.x of that gem we need this constant because:

  • (lua.rb) the evalsha method signature changed between v2.x and v3.x of the redis ruby gem

  • (worker.rb) in v3.x you have to reconnect to the redis server after forking the process

UnsupportedRedisVersionError
VERSION

Public Class Methods

failure_formatter() click to toggle source
# File lib/qless.rb, line 44
def failure_formatter
  @failure_formatter ||= FailureFormatter.new
end
generate_jid() click to toggle source
# File lib/qless.rb, line 34
def generate_jid
  SecureRandom.uuid.gsub('-', '')
end
stringify_hash_keys(hash) click to toggle source
# File lib/qless.rb, line 38
def stringify_hash_keys(hash)
  hash.each_with_object({}) do |(key, value), result|
    result[key.to_s] = value
  end
end

Private Instance Methods

failure_formatter() click to toggle source
# File lib/qless.rb, line 44
def failure_formatter
  @failure_formatter ||= FailureFormatter.new
end
generate_jid() click to toggle source
# File lib/qless.rb, line 34
def generate_jid
  SecureRandom.uuid.gsub('-', '')
end
stringify_hash_keys(hash) click to toggle source
# File lib/qless.rb, line 38
def stringify_hash_keys(hash)
  hash.each_with_object({}) do |(key, value), result|
    result[key.to_s] = value
  end
end