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

Add yarddoc files to gitignore, remove yardoc from rake tasks, update api file

This commit is contained in:
SamArdrey 2022-06-14 17:26:58 -07:00
parent 2a24d541bd
commit 67283ce73b
4 changed files with 46 additions and 27 deletions

2
.gitignore vendored
View file

@ -17,3 +17,5 @@ development.log
/docker-compose.yml /docker-compose.yml
Gemfile.lock Gemfile.lock
*.DS_Store *.DS_Store
doc/
.yardoc/

View file

@ -1,4 +1,4 @@
--title "Sidekiq" --title "Sidekiq"
--query '@return || @param || '@yield' || @api.text == "public"' --query '(@return || @param || @yield || @attr_reader || @api.text == "public") && @api.text != "private"'
--readme docs/menu.md --readme docs/menu.md
- Changes.md - Changes.md

View file

@ -4,18 +4,8 @@ require "standard/rake"
require "yard" require "yard"
require "yard/rake/yardoc_task" require "yard/rake/yardoc_task"
YARD::Rake::YardocTask.new do |yard| # If you want to generate the docs, run yarddoc from your terminal
# keeping this in here for now, but code can be deleted once we are ready # https://rubydoc.info/gems/yard/file/README.md
# to push. .yardopts takes care of this.
# yard.files = [
# "lib/sidekiq/api.rb",
# "lib/sidekiq/client.rb",
# "lib/sidekiq/worker.rb",
# # "lib/sidekiq/job.rb",
# "-",
# "Changes.md",
# "docs/menu.md"]
end
Rake::TestTask.new(:test) do |test| Rake::TestTask.new(:test) do |test|
test.warning = true test.warning = true

View file

@ -7,6 +7,7 @@ require "base64"
# @api public # @api public
module Sidekiq module Sidekiq
# @api private
class Stats class Stats
def initialize def initialize
fetch_stats_fast! fetch_stats_fast!
@ -214,7 +215,6 @@ module Sidekiq
# job.args # => [1, 2, 3] # job.args # => [1, 2, 3]
# job.delete if job.jid == 'abcdef1234567890' # job.delete if job.jid == 'abcdef1234567890'
# end # end
#
class Queue class Queue
include Enumerable include Enumerable
@ -310,7 +310,9 @@ module Sidekiq
end end
alias_method :💣, :clear alias_method :💣, :clear
def as_json(options = nil) # :nodoc: # :nodoc:
# @api private
def as_json(options = nil)
{name: name} # 5336 {name: name} # 5336
end end
end end
@ -320,24 +322,30 @@ module Sidekiq
# #
# The job should be considered immutable but may be # The job should be considered immutable but may be
# removed from the queue via JobRecord#delete. # removed from the queue via JobRecord#delete.
#
class JobRecord class JobRecord
# the parsed Hash of job data # the parsed Hash of job data
# @!attribute [r] Item
attr_reader :item attr_reader :item
# the underlying String in Redis # the underlying String in Redis
# @!attribute [r] Value
attr_reader :value attr_reader :value
# the queue associated with this job # the queue associated with this job
# @!attribute [r] Queue
attr_reader :queue attr_reader :queue
def initialize(item, queue_name = nil) # :nodoc: # :nodoc:
# @api private
def initialize(item, queue_name = nil)
@args = nil @args = nil
@value = item @value = item
@item = item.is_a?(Hash) ? item : parse(item) @item = item.is_a?(Hash) ? item : parse(item)
@queue = queue_name || @item["queue"] @queue = queue_name || @item["queue"]
end end
def parse(item) # :nodoc: # :nodoc:
# @api private
def parse(item)
Sidekiq.load_json(item) Sidekiq.load_json(item)
rescue JSON::ParserError rescue JSON::ParserError
# If the job payload in Redis is invalid JSON, we'll load # If the job payload in Redis is invalid JSON, we'll load
@ -496,7 +504,9 @@ module Sidekiq
attr_reader :score attr_reader :score
attr_reader :parent attr_reader :parent
def initialize(parent, score, item) # :nodoc: # :nodoc:
# @api private
def initialize(parent, score, item)
super(item) super(item)
@score = Float(score) @score = Float(score)
@parent = parent @parent = parent
@ -597,9 +607,12 @@ module Sidekiq
include Enumerable include Enumerable
# Redis key of the set # Redis key of the set
# @!attribute [r] Name
attr_reader :name attr_reader :name
def initialize(name) # :nodoc: # :nodoc:
# @api private
def initialize(name)
@name = name @name = name
@_size = size @_size = size
end end
@ -635,7 +648,9 @@ module Sidekiq
end end
alias_method :💣, :clear alias_method :💣, :clear
def as_json(options = nil) # :nodoc: # :nodoc:
# @api private
def as_json(options = nil)
{name: name} # 5336 {name: name} # 5336
end end
end end
@ -718,7 +733,9 @@ module Sidekiq
nil nil
end end
def delete_by_value(name, value) # :nodoc: # :nodoc:
# @api private
def delete_by_value(name, value)
Sidekiq.redis do |conn| Sidekiq.redis do |conn|
ret = conn.zrem(name, value) ret = conn.zrem(name, value)
@_size -= 1 if ret @_size -= 1 if ret
@ -726,7 +743,9 @@ module Sidekiq
end end
end end
def delete_by_jid(score, jid) # :nodoc: # :nodoc:
# @api private
def delete_by_jid(score, jid)
Sidekiq.redis do |conn| Sidekiq.redis do |conn|
elements = conn.zrangebyscore(name, score, score) elements = conn.zrangebyscore(name, score, score)
elements.each do |element| elements.each do |element|
@ -852,13 +871,17 @@ module Sidekiq
class ProcessSet class ProcessSet
include Enumerable include Enumerable
def initialize(clean_plz = true) # :nodoc: # :nodoc:
# @api private
def initialize(clean_plz = true)
cleanup if clean_plz cleanup if clean_plz
end end
# Cleans up dead processes recorded in Redis. # Cleans up dead processes recorded in Redis.
# Returns the number of processes cleaned. # Returns the number of processes cleaned.
def cleanup # :nodoc: # :nodoc:
# @api private
def cleanup
count = 0 count = 0
Sidekiq.redis do |conn| Sidekiq.redis do |conn|
procs = conn.sscan_each("processes").to_a.sort procs = conn.sscan_each("processes").to_a.sort
@ -934,6 +957,8 @@ module Sidekiq
# Returns the identity of the current cluster leader or "" if no leader. # Returns the identity of the current cluster leader or "" if no leader.
# This is a Sidekiq Enterprise feature, will always return "" in Sidekiq # This is a Sidekiq Enterprise feature, will always return "" in Sidekiq
# or Sidekiq Pro. # or Sidekiq Pro.
# @return [String] Identity of cluster leader
# @return [String] empty string if no leader
def leader def leader
@leader ||= begin @leader ||= begin
x = Sidekiq.redis { |c| c.get("dear-leader") } x = Sidekiq.redis { |c| c.get("dear-leader") }
@ -960,7 +985,9 @@ module Sidekiq
# 'identity' => <unique string identifying the process>, # 'identity' => <unique string identifying the process>,
# } # }
class Process class Process
def initialize(hash) # :nodoc: # :nodoc:
# @api private
def initialize(hash)
@attribs = hash @attribs = hash
end end