Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ixti/sidekiq-pauzer
Enhance Sidekiq with queue pausing
https://github.com/ixti/sidekiq-pauzer
sidekiq
Last synced: about 1 month ago
JSON representation
Enhance Sidekiq with queue pausing
- Host: GitHub
- URL: https://github.com/ixti/sidekiq-pauzer
- Owner: ixti
- License: mit
- Created: 2023-11-26T20:39:41.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2024-03-06T20:06:30.000Z (8 months ago)
- Last Synced: 2024-08-10T23:11:27.219Z (3 months ago)
- Topics: sidekiq
- Language: Ruby
- Homepage:
- Size: 115 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.adoc
- Changelog: CHANGES.md
- License: LICENSE.txt
Awesome Lists containing this project
README
= Sidekiq::Pauzer
:ci-url: https://github.com/ixti/sidekiq-pauzer/actions/workflows/ci.yml?query=branch%3Amain
:ci-img: https://github.com/ixti/sidekiq-pauzer/actions/workflows/ci.yml/badge.svg?branch=main
:codecov-url: https://codecov.io/gh/ixti/sidekiq-pauzer/tree/main
:codecov-img: https://codecov.io/gh/ixti/sidekiq-pauzer/graph/badge.svg?token=UKXUG2AA89{ci-url}[image:{ci-img}[CI]]
{codecov-url}[image:{codecov-img}[codecov]]== Installation
Add this line to your application's Gemfile:
$ bundle add sidekiq-pauzer
Or install it yourself as:
$ gem install sidekiq-pauzer
== Usage
[source, ruby]
----
require "sidekiq"
require "sidekiq/pauzer"Sidekiq::Pauzer.configure do |config|
# Set paused queues local cache refresh rate in seconds.
# Default: 5.0
config.refresh_rate = 10.0
end
----When running in forked environment (e.g., Puma web server), you also need to
call `Sidekiq::Pauzer.startup` on fork:[source, ruby]
----
# file: config/puma.rb
on_worker_boot { Sidekiq::Pauzer.startup }
----=== API
This gem enhances Sidekiq's Queue API with:
[source, ruby]
----
Sidekiq::Queue.new("critical").paused? # => true|false
Sidekiq::Queue.new("critical").pause!
Sidekiq::Queue.new("critical").unpause!
----Those translates to:
[source, ruby]
----
Sidekiq::Pauzer.paused?("critical") # => true|false
Sidekiq::Pauzer.pause!("critical")
Sidekiq::Pauzer.unpause!("critical")
----=== Adding Pause/Resume Button to the Queues Tab
If you're not overriding `Sidekiq::Web.views` path, then you can override
default queues tab with:[source, ruby]
----
require "sidekiq/web"
require "sidekiq/pauzer/web"
----NOTE: If you are using custom Sidekiq views path, then you will need to call
(after requiring `sidekiq/pauzer/web`): `Sidekiq::Pauzer::Web.unpatch_views!`.== Compatibility
This library aims to support and is tested against:
* https://www.ruby-lang.org[Ruby]
** MRI 3.0.x
** MRI 3.1.x
** MRI 3.2.x
** MRI 3.3.x
* https://github.com/sidekiq/sidekiq[Sidekiq]
** 7.2.x
* https://redis.io[Redis]
** 6.2.x
** 7.0.x
** 7.2.xIf something doesn't work on one of these versions, it's a bug.
This library may inadvertently work (or seem to work) on other Ruby, Redis, and
Sidekiq versions, however support will only be provided for the versions listed
above.If you would like this library to support another Ruby, Redis, or Sidekiq
version, you may volunteer to be a maintainer. Being a maintainer entails making
sure all tests run and pass on that implementation. When something breaks on
your implementation, you will be responsible for providing patches in a timely
fashion. If critical issues for a particular implementation exist at the time of
a major release, support for that Ruby, Redis, and/or Sidekiq version may be
dropped.== Development
bundle install
bundle exec appraisal generate
bundle exec appraisal install
bundle exec rake== Contributing
* Fork sidekiq-pauzer
* Make your changes
* Ensure all tests pass (`bundle exec rake`)
* Send a merge request
* If we like them we'll merge them
* If we've accepted a patch, feel free to ask for commit access!