在heroku中使用sidekiq / redistogo?

问题描述 投票:0回答:0

我关注了sideqik gem教程文档和heroku Redistogo插件文档

初始值设定项/sidekiq.rb:

Sidekiq.configure_server do |config|
  config.redis = { url: 'redis://redistogo:xxx.redistogo.com:10076/' }
end

Sidekiq.configure_client do |config|
  config.redis = { url: 'redis://redistogo:xxx.redistogo.com:10076/' }
end

app / workers / hard_woker.rb:

class HardWorker
  include Sidekiq::Worker
  def perform(shop_domain, webhook)
   #performing stuffs
end

Webhook我正在从事后台工作(至少要尝试):

class OrdersCreateJob < ActiveJob::Base
  def perform(shop_domain:, webhook:)
    shop = Shop.find_by(shopify_domain: shop_domain)
    shop.with_shopify_session do
      HardWorker.perform_async(shop_domain, webhook)
    end
  end
end

程序文件:

hardworker: bundle exec sidekiq -t 25

控制台中没有错误。

这里出问题了,我想念什么吗?

我的队列:

irb(main):003:0> Sidekiq::Queue.all
=> [#<Sidekiq::Queue:0x000055b53a2d0920 @name="default", @rname="queue:default">]

我认为这意味着什么都没有排队?

我的目标是将我所有的CreateOrderWebhook代码(近500行)带入后台作业,以减轻应用程序的负担,并阻止webhooks / prevent webhooks被阻止

ruby-on-rails ruby heroku redis sidekiq
© www.soinside.com 2019 - 2024. All rights reserved.