Low commit activity in last 3 years
No release in over a year
Simple scheduler for long-running and infrequent tasks, no threads, always in serial
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
 Project Readme

Simple scheduler for long-running and infrequent tasks.

  • no threads, always in serial, to avoid out-of-memory issues and race-conditions
  • forks for each execution to avoid leaking memory
  • no dependencies
  • supports crons with timezones via fugit

Install

gem install serial_scheduler

Usage

require 'serial_scheduler'
scheduler = SerialScheduler.new

scheduler.add :foo, interval: 10, timeout: 2 do
  puts 'Doing foo'
end
scheduler.add :bar, interval: 5, timeout: 1 do
  puts 'Doing bar'
end

require 'fugit'
scheduler.add :bar, cron: "* * * * * America/New_York", timeout: 1 do
  puts 'Doing cron'
end

scheduler.run

Logging

SerialScheduler.new logger: my_logger

message: "Waiting to start job", job: :foo, in: 15, at: '2019-12-30 11:00:00'

Errors

Send to error service of your choice, or don't set it and it will raise and stop.

SerialScheduler.new error_handler: ->(e) { puts e }

Stopping

Will not start any new task, but finish the current one.

scheduler.stop

Author

Michael Grosser
michael@grosser.it
License: MIT
Build Status