Sidekiq schedule same worker to queue when done

后端 未结 1 561
花落未央
花落未央 2021-01-14 01:51

I am using Sidekiq with Rails 3, with the following worker class:

class BotWorker
   include Sidekiq::Worker

   def perform(user_id)
      user = User.find(         


        
相关标签:
1条回答
  • 2021-01-14 02:27

    Strange. I do the same thing except use self.class instead of BotWorker and it works. I don't have any arguments for my perform method though.

    You might want to wrap your method in a begin/rescue/ensure block and move the re-queuing into the ensure block.

    If User.find fails to find a user, it's going to raise an error which Sidekiq will catch and should move your job into the Retry queue. Probably not what you want.

    0 讨论(0)
提交回复
热议问题