Skip to content


Subversion checkout URL

You can clone with
Download ZIP
A simple, production-ready chronological scheduler for Redis.
tag: release-0.5

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.


RedisScheduler is a chronological scheduler for Redis. It allows you to schedule
items to be processed at arbitrary points in time (via RedisScheduler#schedule!)
and easily retrieve only those items that are due to be processed (via

It does everything you'd expect from a production scheduler:
* You can schedule items at arbitrary times.
* You can iterate over ready items in either blocking or non-blocking mode.
* It supports multiple simultaneous readers and writers.
* A Ruby exception causes the item to be rescheduled at the original time.
* Work items lost as part of a Ruby crash or segfault are recoverable.

In non-blocking mode (the default), RedisScheduler#each will iterate only over
those work items whose scheduled time is less than or equal to the current time,
and then stop. In blocking mode, RedisScheduler#each will iterate over the same
items, but will also block until items are available. In this mode, #each will
never return.

For debugging purposes, you can use RedisScheduler#items to iterate over all
items in the queue, but note that this method is not guaranteed to be

For error recovery purposes, you can use RedisScheduler#processing_set_items
to iterate over all the items in the processing set to determine whether any
of them are the result of a process crash.

== Synopsis

  r =
  s = r, blocking: true
  startt =
  s.schedule! "a", startt + 10
  s.schedule! "b", startt + 15
  s.schedule! "c", startt + 20
  s.each { |item, at| puts "#{ - startt}: #{item}" }


  10.03481788: a
  15.05255288: b
  20.06058172: c
  ... waits forever ...

== Implementation

See for some details.

== Bug reports

Please file bugs here:
Please send comments to:
Something went wrong with that request. Please try again.