Skip to content

Re-introduce weighted queues#112

Merged
mperham merged 4 commits intomasterfrom
queue_weights
Apr 4, 2012
Merged

Re-introduce weighted queues#112
mperham merged 4 commits intomasterfrom
queue_weights

Conversation

@ryanlecompte
Copy link
Contributor

Here's a first pass at re-introducing weighted queues. The basic idea is to dynamically pass in a set of queues (respecting weights) to Redis#blpop. This way we avoid queue starvation. Thoughts welcome.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to do this map every time this method is called.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, I was thinking that for each iteration you'd want to invoke the @queues.sample(@num_queues) so that you apply the weights for each iteration. Once you know which queues you want to pass to blpop, then you'd do queues.map { |q| "queue:#{q}" }. I think we could have a map that create in the #initialize that maps queue names to their equivalent "queue:#{q}" form.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's what I mean: the queue name can be mapped in advance.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, refresh pull request - I've updated it to map the queue names just once in #initialize.

@mperham
Copy link
Collaborator

mperham commented Apr 4, 2012

Needs more hot developer-on-changelog action.

mperham added a commit that referenced this pull request Apr 4, 2012
@mperham mperham merged commit 73c7962 into master Apr 4, 2012
@bnorton
Copy link
Contributor

bnorton commented Apr 6, 2012

I am interested by the fact that you only have tests for the cli. Is this common practice to merge untested code?

@mperham
Copy link
Collaborator

mperham commented Apr 6, 2012

I have a series of manual integration tests I run through with live processing to verify nothing is obviously broken. I welcome pull requests to increase test coverage. :-)

@mperham mperham deleted the queue_weights branch July 19, 2014 15:11
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.

3 participants