mirror of
https://github.com/endofunky/sidetiq.git
synced 2022-11-09 13:53:30 -05:00
Add Sidetiq.workers.
This commit is contained in:
parent
5058048ae3
commit
4b0a71ff51
2 changed files with 9 additions and 0 deletions
|
@ -20,6 +20,11 @@ require 'sidetiq/version'
|
||||||
|
|
||||||
# The Sidetiq namespace.
|
# The Sidetiq namespace.
|
||||||
module Sidetiq
|
module Sidetiq
|
||||||
|
# Public: Returns an Array of workers including Sidetiq::Schedulable.
|
||||||
|
def self.workers
|
||||||
|
schedules.keys
|
||||||
|
end
|
||||||
|
|
||||||
# Public: Returns a Hash of Sidetiq::Schedule instances.
|
# Public: Returns a Hash of Sidetiq::Schedule instances.
|
||||||
def self.schedules
|
def self.schedules
|
||||||
Clock.synchronize do
|
Clock.synchronize do
|
||||||
|
|
|
@ -6,5 +6,9 @@ class TestSidetiq < Sidetiq::TestCase
|
||||||
assert_equal [ScheduledWorker], Sidetiq.schedules.keys
|
assert_equal [ScheduledWorker], Sidetiq.schedules.keys
|
||||||
assert_kind_of Sidetiq::Schedule, Sidetiq.schedules[ScheduledWorker]
|
assert_kind_of Sidetiq::Schedule, Sidetiq.schedules[ScheduledWorker]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_workers
|
||||||
|
assert_equal [ScheduledWorker], Sidetiq.workers
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue