Skip to content

Conversation

@amokan
Copy link

@amokan amokan commented Nov 3, 2016

Adds an optional limit argument for Conqueuer.Queue to allow you to specify a rigid queue limit and prevent additional items from being added until it burns down. I've been using this in a production environment and its worked out well.

Totally understand if you don't want to add this, but figured I'd toss it your way anyhow.


Example:

worker(Conqueuer.Queue, [[limit: 100], [name: :SomeQueue]], id: :some_queue)

If the limit argument is provided and the queue is at its limit, calling
Conqueuer.work(:some_pool, some_args) will return :limit_reached - otherwise it will return :ok like usual.

Also added a couple helper functions:

  • Conqueuer.Queue.limit_reached?( :some_queue ) - returns true or false
  • Conqueuer.Queue.limit( :some_queue ) - returns integer limit size or :unlimited

I also updated the specs with these new features and added docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant