README.md in sidekiq-limit_fetch-1.1 vs README.md in sidekiq-limit_fetch-1.2
- old
+ new
@@ -1,18 +1,14 @@
## Description
Sidekiq strategy to restrict number of workers
which are able to run specified queues simultaneously.
-[![Build
-Status](https://secure.travis-ci.org/brainopia/sidekiq-limit_fetch.png)](http://travis-ci.org/brainopia/sidekiq-limit_fetch)
-[![Gem
-Version](https://badge.fury.io/rb/sidekiq-limit_fetch.png)](http://badge.fury.io/rb/sidekiq-limit_fetch)
-[![Dependency
-Status](https://gemnasium.com/brainopia/sidekiq-limit_fetch.png)](https://gemnasium.com/brainopia/sidekiq-limit_fetch)
-[![Code
-Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/brainopia/sidekiq-limit_fetch)
+[![Build Status](https://secure.travis-ci.org/brainopia/sidekiq-limit_fetch.png)](http://travis-ci.org/brainopia/sidekiq-limit_fetch)
+[![Gem Version](https://badge.fury.io/rb/sidekiq-limit_fetch.png)](http://badge.fury.io/rb/sidekiq-limit_fetch)
+[![Dependency Status](https://gemnasium.com/brainopia/sidekiq-limit_fetch.png)](https://gemnasium.com/brainopia/sidekiq-limit_fetch)
+[![Code Climate](https://codeclimate.com/github/brainopia/sidekiq-limit_fetch.png)](https://codeclimate.com/github/brainopia/sidekiq-limit_fetch)
## Installation
Add this line to your application's Gemfile:
@@ -41,11 +37,18 @@
workers simultaneously.
Ability to set limits dynamically allows you to resize worker
distribution among queues any time you want.
+### Busy workers by queue
+You can see how many workers currently handling a queue:
+
+```ruby
+ Sidekiq::Queue['name'].busy # number of busy workers
+```
+
### Pauses
You can also pause your queues temporarely. Upon continuing their limits
will be preserved.
@@ -53,17 +56,10 @@
Sidekiq::Queue['name'].pause # prevents workers from running tasks from this queue
Sidekiq::Queue['name'].paused? # => true
Sidekiq::Queue['name'].unpause # allows workers to use the queue
```
-
-You can see how many workers currently handling a queue:
-
-```ruby
- Sidekiq::Queue['name'].busy # number of busy workers
-```
-
### Multiple processes
Limits are applied per process. In case you have several worker
processes and want to have global locks between them, you'll need to
enable global mode by setting global option, eg:
@@ -104,9 +100,32 @@
Sidekiq::Queue['name'].block
Sidekiq::Queue['name'].blocking? # => true
Sidekiq::Queue['name'].unblock
```
+### Advanced blocking queues
+
+You can also block on array of queues. It means when any of them is
+running only queues higher and queues from their blocking group can
+run. It will be easier to understand with an example:
+
+```yaml
+ :queues:
+ - a
+ - b
+ - c
+ - d
+ :blocking:
+ - [b, c]
+```
+
+In this case tasks from `d` will be blocked when a task from queue `b` or `c` is executed.
+
+You can dynamically set exceptions for queue blocking:
+
+```ruby
+ Sidekiq::Queue['queue1'].block_except 'queue2'
+```
### Thanks
Sponsored by [Evil Martians].
[Evil Martians]: http://evilmartians.com/