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

Remove wrong Server::Middleware#worker_class override #156

Merged
merged 1 commit into from
Jan 19, 2016

Conversation

vkuznetsov
Copy link
Contributor

I want to run my job once per 10 mins and I created worker like this:

class Workers::MyWorker
  include Sidekiq::Worker
  sidekiq_options unique: :until_timeout, unique_expiration: 10.minutes
end

But lock is removed after job completion.

I found that instead of Lock::UntilTimeout the Lock::UntilExecuted is used.

This line in Server::Middleware overrides the worker_class delegator defined above:

class Middleware
  def_instance_delegator :@worker, :class, :worker_class
  ...
  attr_reader :redis_pool, :worker, :item, :worker_class
end

Because of this in Server::Middleware#options worker_class is nil and @options is set to Sidekiq.default_worker_options insted of specified in my worker:

def options
  @options ||= worker_class.get_sidekiq_options if worker_class.respond_to?(:get_sidekiq_options)
  @options ||= Sidekiq.default_worker_options
  @options ||= {}
  @options &&= @options.stringify_keys
end

mhenrixon added a commit that referenced this pull request Jan 19, 2016
Remove wrong Server::Middleware#worker_class override
@mhenrixon mhenrixon merged commit 6763c07 into mhenrixon:master Jan 19, 2016
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