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:
parent
44e170b1f7
commit
bf940ccffc
1 changed files with 20 additions and 12 deletions
32
README.md
32
README.md
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue