Skip to content

Fix worker validator#685

Merged
mhenrixon merged 1 commit intomhenrixon:mainfrom
victorfgs:fix-worker-validator
Feb 21, 2022
Merged

Fix worker validator#685
mhenrixon merged 1 commit intomhenrixon:mainfrom
victorfgs:fix-worker-validator

Conversation

@victorfgs
Copy link
Copy Markdown
Contributor

When setting a worker like so

# frozen_string_literal: true

class DemoJob

  include Sidekiq::Worker

  sidekiq_options queue: :low_priority,
                  lock: :until_and_while_executing,
                  on_conflict: {
                    client: :replace,
                    server: :raise,
                  }

  def perform(stub_id)
    p stub_id
  end
end

the rspec matcher passes because the get_sidekiq_options method returns something like

{
  "retry"=>3,
  "queue"=>:low_priority,
  "lock"=>:until_and_while_executing,
  "on_conflict"=>{ :client => :replace, :server => :raise }
}

since the on_conflict hash have symbol keys, the validator ends up returning valid.

This PR adds a check on the symbol keys just be sure we are checking the correct places.

Let me know if there's something else I can do to help in that fix :)

@mhenrixon mhenrixon merged commit 17e2ccc into mhenrixon:main Feb 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants