Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix worker validator #685

Merged
merged 1 commit into from
Feb 21, 2022
Merged

Conversation

victorfgs
Copy link
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.

None yet

2 participants