Skip to content

Why is SidekiqUnique behaviour applied to regular Workers?  #100

@pik

Description

@pik

I've been updating the tests for the run_lock PR and noticed this behaviour.

For example AfterYield Worker is defined with unique: false
https://github.com/mhenrixon/sidekiq-unique-jobs/blob/master/spec%2Fsupport%2Fafter_yield_worker.rb

But there are tests which still expect it to unlock: https://github.com/mhenrixon/sidekiq-unique-jobs/blob/master/spec%2Flib%2Fserver%2Fmiddleware_spec.rb#L90

In fact this fails:

  class RegularWorker
    include Sidekiq::Worker
    sidekiq_options queue: QUEUE

    def perform(*)
      true
    end
  end
    context "#RegularWorker" do
      it "unlock is never called for a worker not using unique extension" do
        jid = RegularWorker.perform_async('test')
        item = Sidekiq::Queue.new(QUEUE).find_job(jid).item
        expect(@middleware).not_to receive(:unlock)
        @middleware.call(RegularWorker.new, item, QUEUE) do
          true
        end
      end
    end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions