Module: Qless

Extended by:
Qless
Included in:
Qless
Defined in:
lib/qless/server.rb,
lib/qless.rb,
lib/qless.rb,
lib/qless/job.rb,
lib/qless/queue.rb,
lib/qless/config.rb,
lib/qless/worker.rb,
lib/qless/version.rb,
lib/qless/lua_script.rb,
lib/qless/subscriber.rb,
lib/qless/wait_until.rb,
lib/qless/middleware/sentry.rb,
lib/qless/job_reservers/ordered.rb,
lib/qless/job_reservers/round_robin.rb,
lib/qless/middleware/redis_reconnect.rb,
lib/qless/middleware/retry_exceptions.rb,
lib/qless/job_reservers/shuffled_round_robin.rb

Overview

Much of this is shamelessly poached from the resque web client

Defined Under Namespace

Modules: JobReservers, Middleware, WaitUntil Classes: BaseJob, Client, ClientEvents, ClientJobs, ClientQueues, ClientWorkers, Config, Job, LuaScript, Queue, QueueJobs, RecurringJob, Server, Subscriber, Worker

Constant Summary collapse

Error =

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

Class.new(StandardError)
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

::Redis::VERSION.to_f < 3.0
UnsupportedRedisVersionError =
Class.new(Error)
VERSION =
"0.9.3"
RetryExceptions =

For backwards compatibility

Middleware::RetryExceptions

Instance Method Summary collapse

Instance Method Details

#generate_jidObject



28
29
30
# File 'lib/qless.rb', line 28

def generate_jid
  SecureRandom.uuid.gsub('-', '')
end

#stringify_hash_keys(hash) ⇒ Object



32
33
34
35
36
# File 'lib/qless.rb', line 32

def stringify_hash_keys(hash)
  hash.each_with_object({}) do |(key, value), result|
    result[key.to_s] = value
  end
end

#worker_nameObject

This is a unique identifier for the worker



39
40
41
# File 'lib/qless.rb', line 39

def worker_name
  @worker_name ||= [Socket.gethostname, Process.pid.to_s].join('-')
end