mirror of
https://github.com/mperham/sidekiq.git
synced 2022-11-09 13:52:34 -05:00
Improve API rdoc
This commit is contained in:
parent
877b528aaf
commit
0f8c914ddb
1 changed files with 22 additions and 3 deletions
|
@ -191,6 +191,9 @@ module Sidekiq
|
||||||
class Queue
|
class Queue
|
||||||
include Enumerable
|
include Enumerable
|
||||||
|
|
||||||
|
##
|
||||||
|
# Return all known queues within Redis.
|
||||||
|
#
|
||||||
def self.all
|
def self.all
|
||||||
Sidekiq.redis {|c| c.smembers('queues'.freeze) }.sort.map {|q| Sidekiq::Queue.new(q) }
|
Sidekiq.redis {|c| c.smembers('queues'.freeze) }.sort.map {|q| Sidekiq::Queue.new(q) }
|
||||||
end
|
end
|
||||||
|
@ -211,6 +214,11 @@ module Sidekiq
|
||||||
false
|
false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
##
|
||||||
|
# Calculates this queue's latency, the difference in seconds since the oldest
|
||||||
|
# job in the queue was enqueued.
|
||||||
|
#
|
||||||
|
# @return Float
|
||||||
def latency
|
def latency
|
||||||
entry = Sidekiq.redis do |conn|
|
entry = Sidekiq.redis do |conn|
|
||||||
conn.lrange(@rname, -1, -1)
|
conn.lrange(@rname, -1, -1)
|
||||||
|
@ -240,6 +248,11 @@ module Sidekiq
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
##
|
||||||
|
# Find the job with the given JID within this queue.
|
||||||
|
#
|
||||||
|
# This is a slow, inefficient operation. Do not use under
|
||||||
|
# normal conditions. Sidekiq Pro contains a faster version.
|
||||||
def find_job(jid)
|
def find_job(jid)
|
||||||
detect { |j| j.jid == jid }
|
detect { |j| j.jid == jid }
|
||||||
end
|
end
|
||||||
|
@ -349,7 +362,7 @@ module Sidekiq
|
||||||
end
|
end
|
||||||
|
|
||||||
def [](name)
|
def [](name)
|
||||||
@item.__send__(:[], name)
|
@item[name]
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
@ -531,6 +544,11 @@ module Sidekiq
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
##
|
||||||
|
# Find the job with the given JID within this sorted set.
|
||||||
|
#
|
||||||
|
# This is a slow, inefficient operation. Do not use under
|
||||||
|
# normal conditions. Sidekiq Pro contains a faster version.
|
||||||
def find_job(jid)
|
def find_job(jid)
|
||||||
self.detect { |j| j.jid == jid }
|
self.detect { |j| j.jid == jid }
|
||||||
end
|
end
|
||||||
|
@ -633,7 +651,6 @@ module Sidekiq
|
||||||
#
|
#
|
||||||
# Yields a Sidekiq::Process.
|
# Yields a Sidekiq::Process.
|
||||||
#
|
#
|
||||||
|
|
||||||
class ProcessSet
|
class ProcessSet
|
||||||
include Enumerable
|
include Enumerable
|
||||||
|
|
||||||
|
@ -697,7 +714,8 @@ module Sidekiq
|
||||||
end
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
# Sidekiq::Process has a set of attributes which look like this:
|
# Sidekiq::Process represents an active Sidekiq process talking with Redis.
|
||||||
|
# Each process has a set of attributes which look like this:
|
||||||
#
|
#
|
||||||
# {
|
# {
|
||||||
# 'hostname' => 'app-1.example.com',
|
# 'hostname' => 'app-1.example.com',
|
||||||
|
@ -761,6 +779,7 @@ module Sidekiq
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
|
# A worker is a thread that is currently processing a job.
|
||||||
# Programmatic access to the current active worker set.
|
# Programmatic access to the current active worker set.
|
||||||
#
|
#
|
||||||
# WARNING WARNING WARNING
|
# WARNING WARNING WARNING
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue