ruby on rails - Does Sidekiq execute jobs in the order they are sent to a worker? -
i have rake task going call 4 more rake tasks, in order:
rake:one rake:two rake:three rake:four
rake tasks one, two, , 3 getting data , adding database. rake:four
going data. need make sure one, two, , 3 complete first. each rake task spinning sidekiq workers run in background. in scenario, of workers created rake:one
finish first, rake:two
, etc?
if not, how can ensure workers executed in order?
sidekiq processes jobs in order created, default processes multiple jobs simultaneously, , there no guarantee given job finish before job started.
quoting https://github.com/mperham/sidekiq/wiki/faq:
how can process queue in serial?
you can't, design. sidekiq designed asynchronous processing of jobs can completed in isolation , independent of each other. jobs popped off of redis in order in pushed there's no guarantee job #1 execute before job #2 started.
if need serial execution, should other systems give types of guarantees.
note can create sidekiq process dedicated processing queue single worker. give serial execution it's hack.
also note can use third-party extensions sidekiq achieve goal.
Comments
Post a Comment