Reputation: 6761
I am using Sidekiq in one of my projects. Now I need to clear a queue,
the RetrySet
, to be more specific.
Following this page from Sidekiq's Github manual, this should work:
Loading development environment (Rails 4.2.1)
>> Sidekiq::RetrySet.new.clear
NameError: uninitialized constant Sidekiq::RetrySet
But it doesn't. Sidekiq itself seems to be loaded:
>> Sidekiq
=> Sidekiq
What am I doing wrong here?
EDIT:
Using Sidekiq version 3.3.4
Upvotes: 2
Views: 3005
Reputation: 12514
Looks like you need to require the api library explicitly.
require 'sidekiq/api'
See this for more info https://github.com/mperham/sidekiq/issues/1732
See https://github.com/mperham/sidekiq/blob/master/lib/sidekiq/api.rb#L612
The inheritance explaination
class SortedSet
...
def clear
...
end
end
class JobSet < SortedSet
...
end
class RetrySet < JobSet
...
end
However, In my rails console it worked without needing me to require the library. It was already required. see
> require 'sidekiq/api'
=> false
I use Sidekiq 4.0.1
> Sidekiq::VERSION
=> "4.0.1"
Upvotes: 11