Sidekiq assigns the same employee to the queue when this is done

I am using Sidekiq with Rails 3 with the following working class:

class BotWorker
   include Sidekiq::Worker

   def perform(user_id)
      user = User.find(user_id)
      puts user.email

      if condition # always true for now
           BotWorker.perform_in(1.hour, user_id) # not working
      end
   end
end

My controller just has

BotWorker.perform_async(user_id)

However, on the Sidekiq dashboard, it doesn't look like another worker is planned.

I would also like to note that the repetition is conditional, so it does not look like I can use the sidetiq or somekikiq extension.

Still new to Sidekiq, read the documentation. What am I missing?

+4
source share
1 answer

It’s strange. I am doing the same thing except using self.classinstead BotWorker, and it works. However, I have no arguments for my method perform.

, start/rescue/proof .

User.find , , Sidekiq , Retry. , , .

+4

All Articles