Skip to content
New issue

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

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

Already on GitHub? # to your account

Unable to setup in standalone Ruby project #523

Closed
marlonoso opened this issue Jun 30, 2020 · 1 comment
Closed

Unable to setup in standalone Ruby project #523

marlonoso opened this issue Jun 30, 2020 · 1 comment
Assignees

Comments

@marlonoso
Copy link

marlonoso commented Jun 30, 2020

Describe the bug
Always getting a configuration error when setting up in a standalone Ruby project

Expected behavior
Not having undefined method 'class_attribute' for SidekiqUniqueJobs::Server::Middleware:Class error

Current behavior
Getting undefined method 'class_attribute' for SidekiqUniqueJobs::Server::Middleware:Class error at project start

Worker class

require 'sidekiq'
require 'sidekiq-unique-jobs'

class MailWorker
  include Sidekiq::Worker
  sidekiq_options lock: :until_executed

  def perform(args)
    puts args
  end
end

Additional context
Startup file

require 'sidekiq'
require 'sidekiq-cron'
require 'sidekiq-unique-jobs'

Sidekiq.configure_server do |config|
  config.redis = { url: "redis://#{ENV['REDIS_HOST']}:#{ENV['REDIS_PORT']}/0" }
end

Sidekiq.configure_client do |config|
  config.redis = { url: "redis://#{ENV['REDIS_HOST']}:#{ENV['REDIS_PORT']}/0" }
end

Sidekiq.client_middleware do |chain|
  chain.add Sidekiq::GlobalId::ClientMiddleware
  chain.add SidekiqUniqueJobs::Middleware::Client
end

Sidekiq.server_middleware do |chain|
  chain.add SidekiqUniqueJobs::Middleware::Server
  chain.add Sidekiq::GlobalId::ServerMiddleware
end

SidekiqUniqueJobs.configure do |config|
  config.debug_lua       = true
  config.lock_info       = true
  config.max_history     = 10_000
  config.reaper          = :lua
  config.reaper_count    = 10_000
  config.reaper_interval = 10
  config.reaper_timeout  = 5
end

Backtrace

undefined method `class_attribute' for SidekiqUniqueJobs::Server::Middleware:Class
Did you mean?  class_variables
/usr/local/bundle/gems/sidekiq-unique-jobs-5.0.2/lib/sidekiq_unique_jobs/options_with_fallback.rb:4:in `included'
/usr/local/bundle/gems/sidekiq-unique-jobs-5.0.2/lib/sidekiq_unique_jobs/server/middleware.rb:8:in `include'
/usr/local/bundle/gems/sidekiq-unique-jobs-5.0.2/lib/sidekiq_unique_jobs/server/middleware.rb:8:in `<class:Middleware>'
/usr/local/bundle/gems/sidekiq-unique-jobs-5.0.2/lib/sidekiq_unique_jobs/server/middleware.rb:3:in `<module:Server>'
/usr/local/bundle/gems/sidekiq-unique-jobs-5.0.2/lib/sidekiq_unique_jobs/server/middleware.rb:2:in `<module:SidekiqUniqueJobs>'
/usr/local/bundle/gems/sidekiq-unique-jobs-5.0.2/lib/sidekiq_unique_jobs/server/middleware.rb:1:in `<top (required)>'
/usr/local/bundle/gems/sidekiq-unique-jobs-5.0.2/lib/sidekiq_unique_jobs/client/middleware.rb:1:in `require'
/usr/local/bundle/gems/sidekiq-unique-jobs-5.0.2/lib/sidekiq_unique_jobs/client/middleware.rb:1:in `<top (required)>'
/usr/local/bundle/gems/sidekiq-unique-jobs-5.0.2/lib/sidekiq_unique_jobs/middleware.rb:19:in `require'
/usr/local/bundle/gems/sidekiq-unique-jobs-5.0.2/lib/sidekiq_unique_jobs/middleware.rb:19:in `block (2 levels) in configure_server_middleware'
/usr/local/bundle/gems/sidekiq-6.0.7/lib/sidekiq.rb:141:in `client_middleware'
/usr/local/bundle/gems/sidekiq-unique-jobs-5.0.2/lib/sidekiq_unique_jobs/middleware.rb:18:in `block in configure_server_middleware'
/usr/local/bundle/gems/sidekiq-6.0.7/lib/sidekiq.rb:75:in `configure_server'
/usr/local/bundle/gems/sidekiq-unique-jobs-5.0.2/lib/sidekiq_unique_jobs/middleware.rb:17:in `configure_server_middleware'
/usr/local/bundle/gems/sidekiq-unique-jobs-5.0.2/lib/sidekiq_unique_jobs/middleware.rb:12:in `configure_middleware'
/usr/local/bundle/gems/sidekiq-unique-jobs-5.0.2/lib/sidekiq_unique_jobs/middleware.rb:7:in `block in extended'
/usr/local/bundle/gems/sidekiq-unique-jobs-5.0.2/lib/sidekiq_unique_jobs/middleware.rb:6:in `class_eval'
/usr/local/bundle/gems/sidekiq-unique-jobs-5.0.2/lib/sidekiq_unique_jobs/middleware.rb:6:in `extended'
/usr/local/bundle/gems/sidekiq-unique-jobs-5.0.2/lib/sidekiq_unique_jobs/middleware.rb:40:in `extend'
/usr/local/bundle/gems/sidekiq-unique-jobs-5.0.2/lib/sidekiq_unique_jobs/middleware.rb:40:in `<top (required)>'
/usr/local/bundle/gems/sidekiq-unique-jobs-5.0.2/lib/sidekiq-unique-jobs.rb:14:in `require'
/usr/local/bundle/gems/sidekiq-unique-jobs-5.0.2/lib/sidekiq-unique-jobs.rb:14:in `<top (required)>'
/srv/app/spam-feed/sidekiq-init.rb:3:in `require'
/srv/app/spam-feed/sidekiq-init.rb:3:in `<top (required)>'
/usr/local/bundle/gems/sidekiq-6.0.7/lib/sidekiq/cli.rb:256:in `require'
/usr/local/bundle/gems/sidekiq-6.0.7/lib/sidekiq/cli.rb:256:in `boot_system'
@mhenrixon
Copy link
Owner

That's an old version :) Any chance you could get hold of say v7.0.1 instead? See #571 for more information

I think I relied on ActiveSupport or reimplemented parts of it for older versions. I can't even remember anymore, it was a long long time ago.

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

No branches or pull requests

2 participants