Skip to content

Duplicated Jobs With Nested Sidekiq Workers #10

@kfalconer

Description

@kfalconer

I have have an issue when using nested workers, where uniqueness is not followed, and leads to duplicate jobs.

When executing RunAJobWorker multiple times it leads to duplicate LongRunningWorker instances.

I am using Sidekiq 2.6.5 and Unique-jobs 2.3.2

Here is the follow code that will reproduce the problem:

class RunAJobWorker
    include Sidekiq::Workder
    sidekiq_options unique: true

    def perform
        # Do some db lookup to find params for this 
        # the job
        id = 10
        LongRunningWorker.perform_async(id)
    end
end

class LongRunningWorker
    include Sidekiq::Workder
    sidekiq_options unique: true

    def perform(id)
        # Find model
        # model = Model.find(id)
        # model long running task
        sleep(10)
    end
end

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions