ruby on rails - Democratic queue in Sidekiq -
users can create project
object contain multiple tasks. when user tells project execute
tasks put on default queue sidekiq.
the problem is: if user creates project 1000 tasks , hit execute
buttom, 1000 tasks put in queue. if after that, user creates project 1 task, when hits executes project, task put on end of line.
i'd background process work on more democratic way. if each project has own queue, chances 1 task second project executed before end of 1000 tasks queue.
to so, need separe queues each project, , should dynamically created. i'm trying accomplish using following instead of perform_async
:
sidekiq::client.push('queue' => "project_#{self.project.id}", 'class' => taskworker, 'args' => [self.id])
however, when try execute
project, tasks placed in queue called "project_somenumber" none of them executed. seems when use sidekiq::client.push
, need tell queue start executing. correct? how can start queue?
sidekiq doesn't support dynamic queue names. when start sidekiq, tell queues process "sidekiq -q queue1 -q queue2 ..." please see sidekiq's advanced options wiki page more detail.
Comments
Post a Comment