Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The work of several unique sidekiq tasks within one queue #225

Closed
dluhhbiu opened this issue May 25, 2017 · 2 comments
Closed

The work of several unique sidekiq tasks within one queue #225

dluhhbiu opened this issue May 25, 2017 · 2 comments

Comments

@dluhhbiu
Copy link

I have a sidekiq queue in which tasks are performed by different users. One user, by his actions, at a time can generate 15-20 tasks and fill the entire queue and the sidekiq worker.

I need to check the task for the uniqueness of the parameters and give the opportunity to perform simultaneously 3 tasks from one user.

Is it possible to save them as something in Enqueued, as does sidekiq-limit_fetch, only based on the arguments of the task?

@mhenrixon
Copy link
Owner

What you are looking for is something like a round robin processor of the queue which balances the jobs between users.

I have seen such work done in the past but it is out of scope for uniqueness. Uniqueness implies only one with the same arguments and per job. You are looking for either creating a unique queue per user or something like that to make it work the way you want.

@dluhhbiu
Copy link
Author

No no no. I solved the problem with 3 tasks per person.
Sidekiq::LoadStatMetrical.perform_async(user.id, params, user.metricals.count % 3)

I have 15-20 tasks on the user. My hope is that I overlooked something in the documentation. And I can keep unique tasks unique_args: ->(args) { [args[0], args[-1]] } in the Busy queue. And the rest will wait for their start in Enqueued.

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

No branches or pull requests

2 participants