Is there any way to tell sidekiq that one job is dependent on another and can't be started until latter is finished?
You can define job dependencies using Sidekiq Superworker:
# config/initializers/superworkers.rb
Superworker.create(:MySuperworker, :user_id) do
Worker1 :user_id
Worker2 :user_id
end
# Anywhere
MySuperworker.perform_async(123)
When you run MySuperworker, Worker1 will start. When it finishes, Worker2 will start. This lets you separate the dependency graph from the workers themselves. (Disclaimer: I'm the gem's author.)