项目作者: fnando

项目描述 :
Sidekiq::Clockwork is a simplistic implementation of a job scheduler based on Clockwork, but without having to run a separated process.
高级语言: Ruby
项目地址: git://github.com/fnando/sidekiq-clockwork.git
创建时间: 2018-10-15T07:17:29Z
项目社区:https://github.com/fnando/sidekiq-clockwork

开源协议:MIT License

下载


sidekiq-clockwork

Tests
Gem
Gem

Sidekiq::Clockwork is a simplistic implementation of a job scheduler based on
Clockwork, but without having to run a separate process.

Installation

  1. gem install sidekiq-clockwork

Or add the following line to your project’s Gemfile:

  1. gem "sidekiq-clockwork"

Usage

Create your job scheduler and make sure that it’s loaded by Sidekiq’s server
(when you run the sidekiq command).

  1. Sidekiq::Clockwork.run do
  2. # This is the default timeout
  3. # sleep_timeout 0.1
  4. # By default, it comes with a error handler like the following:
  5. # error_handler do |error|
  6. # $stderr << "[CLOCKWORK] #{error.class}: #{error.message}"
  7. # $stderr << " (" << error.backtrace_locations.first << ")\n"
  8. # end
  9. #
  10. # You can clean up error handlers with:
  11. # error_handlers.clear
  12. #
  13. # You may want to use an exception tracker like Rollbar:
  14. # error_handler do |error|
  15. # Rollbar.error(error)
  16. # end
  17. #
  18. # You can schedule jobs by using `every`, which receives
  19. # an interval in seconds.
  20. every(30.seconds) { SomeWorker.perform_async }
  21. end

Sidekiq::Clockwork is single-threaded and sequencial by design, so make sure
your scheduler only enqueue jobs without doing any processing (tl;dr make it as
fast as you can).

Maintainer

Contributors

Contributing

For more details about how to contribute, please read
https://github.com/fnando/sidekiq-clockwork/blob/main/CONTRIBUTING.md.

License

The gem is available as open source under the terms of the
MIT License. A copy of the license can be
found at https://github.com/fnando/sidekiq-clockwork/blob/main/LICENSE.md.

Code of Conduct

Everyone interacting in the sidekiq-clockwork project’s codebases, issue
trackers, chat rooms and mailing lists is expected to follow the
code of conduct.