Schdlr
A minimal library for scheduling jobs for later execution.
Installation
Add this line to your application's Gemfile:
gem 'schdlr', git: 'https://github.com/devsfutter/schdlr.git'
And then execute:
$ bundle
Usage
class Job < Schdlr::Job
attr_accessor :id
def perform
puts "#{Time.now}: Job2 doing something with id: ##{id}"
return true
end
end
class JobThatFail < Schdlr::Job
attr_accessor :id
def perform
puts "#{Time.now}: JobThatFail doing something with id: ##{id}"
fail!('missing argument :id') if id.nil?
end
end
@queue = Schdlr::Queue::Sqlite.new
@schhlr = Schdlr.new(@queue)
job1 = Job.new(id: '12344')
job2 = JobThatFail.new
@schhlr.now(job1)
at_time = Time.new(2019,2,2)
@schhlr.at(at_time, job2)
@schhlr.start!
@schhlr.stop!
TODO
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/devsfutter/schdlr. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
License
The gem is available as open source under the terms of the MIT License.
Code of Conduct
Everyone interacting in the Schdlr project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.