faul
faul

Reputation: 35

Ruby on Rails multiple workers with Sidekiq

I'm working with Ruby on Rails application, I need some background process that's why I'm using sidekiq when I'm using one worker then working nice.

Example this below code: For 1 job

#app/config/sidekiq.yml
:schedule:
    send_news:
        cron: "0 20 * * * America/Los_Angeles"
        class: SendNews

Above code working fine. Problem is below code when trying to multiple workers.

#app/config/sidekiq.yml
:schedule:
    send_news:
        cron: "0 20 * * * America/Los_Angeles"
        class: SendNews

:schedule:
    send_notification:
        cron: "0 21 * * * America/Los_Angeles"
        class: SendNotification

:schedule:
    send_summery:
        cron: "0 22 * * * America/Los_Angeles"
        class: SendSummery

This is not running, I don't know what I'm doing wrong.

Every class look like this below:

class SendNews
  include Sidekiq::Worker

  def perform
    load File.join(Rails.root, 'lib', 'task_helpers', 'news_helper.rb')
    NewsHelper.today_news
  end
end

On the class & method working fine when it's single.

Thanks

Upvotes: 0

Views: 660

Answers (1)

whites11
whites11

Reputation: 13260

Just a guess, have you tried with this?

#app/config/sidekiq.yml
:schedule:
  send_news:
    cron: "0 20 * * * America/Los_Angeles"
    class: SendNews
  send_notification:
    cron: "0 21 * * * America/Los_Angeles"
    class: SendNotification
  send_summery:
    cron: "0 22 * * * America/Los_Angeles"
    class: SendSummery

Upvotes: 1

Related Questions