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 RedisScheduler#each). 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 consistent. 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 = Redis.new s = RedisScheduler.new r, blocking: true startt = Time.now s.schedule! "a", startt + 10 s.schedule! "b", startt + 15 s.schedule! "c", startt + 20 s.each { |item, at| puts "#{Time.now - startt}: #{item}" } prints: 10.03481788: a 15.05255288: b 20.06058172: c ... waits forever ... == Implementation See http://masanjin.net/blog/using-redis-for-scheduling for some details. == Bug reports Please file bugs here: https://github.com/wmorgan/redis-scheduler/issues Please send comments to: wmorgan-redis-scheduler-readme@masanjin.net.