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

undefined method 'delete_by_digest' for SidekiqUniqueJobs::Digests:Class #567

Closed
heroturtle opened this issue Jan 21, 2021 · 1 comment
Closed

Comments

@heroturtle
Copy link

heroturtle commented Jan 21, 2021

Describe the bug
Updated to 7.0.1, added middleware according to Readme and I get:
NoMethodError: undefined method `delete_by_digest' for SidekiqUniqueJobs::Digests:Class

Expected behavior
method defined 'delete_by_digest

Current behavior
What happens instead of the expected behavior?

Worker class

# my sidekiq.rb config:
require 'sidekiq/web'

redis_options = { url: ENV["REDIS_URL"] }

Sidekiq.configure_server do |config|
  config.redis = redis_options

   config.server_middleware do |chain|
    chain.add SidekiqUniqueJobs::Middleware::Server
  end

  config.error_handlers << ->(ex, ctx_hash) { p ex, ctx_hash }
  config.death_handlers << lambda do |job, _ex|
    digest = job["lock_digest"]
    SidekiqUniqueJobs::Digests.delete_by_digest(digest) if digest
  end
end

Sidekiq.configure_client do |config|
  config.redis = redis_options

  config.client_middleware do |chain|
    chain.add SidekiqUniqueJobs::Middleware::Client
  end
end

Sidekiq.logger       = Sidekiq::Logger.new($stdout)
Sidekiq.logger.level = :info
Sidekiq.log_format = :json if Sidekiq.respond_to?(:log_format)
SidekiqUniqueJobs.configure do |config|
  config.debug_lua       = false
  config.lock_info       = true
  config.logger          = Sidekiq.logger
  config.max_history     = 10_000
  config.reaper          = :lua
  config.reaper_count    = 10_000
  config.reaper_interval = 10
  config.reaper_timeout  = 5
end
Dir[Rails.root.join("app", "workers", "**", "*.rb")].sort.each { |worker| require worker }

Sidekiq::Web.use(Rack::Auth::Basic) do |user, password|
  [user, password] == ["user_name", "password"]
end
@mhenrixon
Copy link
Owner

Sorry about that, seems like the documentation was wrong. Should be fixed in 6cb272c

The correct usage is:

SidekiqUniqueJobs::Digests.new.delete_by_digest(digest) if digest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants