1
0
Fork 0
mirror of https://github.com/endofunky/sidetiq.git synced 2022-11-09 13:53:30 -05:00

Make things a bit more readable.

This commit is contained in:
Tobias Svensson 2013-03-11 13:31:23 +00:00
parent 44e170b1f7
commit bf940ccffc

View file

@ -115,37 +115,45 @@ end
Sidetiq implements a simple API to support reflection of recurring jobs at
runtime:
```ruby
# Sidetiq.schedules returns a Hash with the Sidekiq::Worker class as the
# key and the Sidetiq::Schedule object as the value:
`Sidetiq.schedules` returns a `Hash` with the `Sidekiq::Worker` class as the
key and the Sidetiq::Schedule object as the value:
```ruby
Sidetiq.schedules
# => { MyWorker => #<Sidetiq::Schedule> }
```
# Sidetiq.workers returns an Array of all workers currently tracked by
# Sidetiq (workers which include Sidetiq::Schedulable and a *tiq* call):
`Sidetiq.workers` returns an `Array` of all workers currently tracked by
Sidetiq (workers which include Sidetiq::Schedulable and a `tiq` call):
```ruby
Sidetiq.workers
# => [MyWorker, AnotherWorker]
```
# Sidetiq.scheduled returns an Array of currently scheduled Sidetiq jobs
# as Sidekiq::SortedEntry (Sidekiq::Job) objects. Optionally, it is
# possible to pass a block to which each job will be yielded:
`Sidetiq.scheduled` returns an `Array` of currently scheduled Sidetiq jobs
as `Sidekiq::SortedEntry` (`Sidekiq::Job`) objects. Optionally, it is
possible to pass a block to which each job will be yielded:
```ruby
Sidetiq.scheduled do |job|
# do stuff ...
end
```
# This list can further be filtered by passing the worker class to #scheduled,
# either as a String or the constant itself:
This list can further be filtered by passing the worker class to `#scheduled`,
either as a String or the constant itself:
```ruby
Sidetiq.scheduled(MyWorker) do |job|
# do stuff ...
end
```
# The same can be done for recurring jobs currently scheduled for retries
# (`.retries` wraps Sidekiq::RetrySet instead of Sidekiq::ScheduledSet):
The same can be done for recurring jobs currently scheduled for retries
(`.retries` wraps `Sidekiq::RetrySet` instead of `Sidekiq::ScheduledSet`):
```ruby
Sidetiq.retries(MyWorker) do |job|
# do stuff ...
end