gpt4 book ai didi

ruby-on-rails - 多个工作流 Sidekiq Icecast Rails

转载 作者:可可西里 更新时间:2023-11-01 10:53:58 26 4
gpt4 key购买 nike

想知道为什么我只能在 sidekiq/redis/icecast Rails Stream 应用程序的特定端口上监听 1 个流。我的文件如下:

icecast.xml

<!-- You may have multiple <listener> elements -->
<listen-socket>
<port>35687</port>
<shoutcast-mount>/hiphop</shoutcast-mount>
<!-- <bind-address>127.0.0.1</bind-address> -->
<!-- <shoutcast-mount>/stream</shoutcast-mount> -->
</listen-socket>
<listen-socket>
<port>35690</port>
<shoutcast-mount>/rock</shoutcast-mount>
</listen-socket>

2 个 worker 在 rails 上

class RadioWorker
include Sidekiq::Worker
sidekiq_options :queue => :radioworker
def perform(*_args)
prev_song = nil
s = Shout.new # ruby-shout instance
s.mount = "/rock" # our mountpoint
s.charset = "UTF-8"
s.port = 35690 # the port we've specified earlier
s.host = 'localhost' # hostname
s.user = 'source' # credentials
s.pass = 'parolata'
s.format = Shout::MP3 # format is MP3
s.description = 'Geek Radio' # an arbitrary name
s.connect


class TestWorker
include Sidekiq::Worker
sidekiq_options :queue => :testworker
def perform(*_args)
prev_song = nil
s = Shout.new # ruby-shout instance
s.mount = "/hiphop" # our mountpoint
s.charset = "UTF-8"
s.port = 35687 # the port we've specified earlier
s.host = 'localhost' # hostname
s.user = 'source' # credentials
s.pass = 'parolata'
s.format = Shout::MP3 # format is MP3
s.description = 'Geek Radio' # an arbitrary name
s.connect

两个 worker 都被设置为在 initializer/sidekiq.rb 中执行异步我在 config/sidekiq.yml 中定义了 sidekiq 队列

:queues:
- ["radioworker", 1]
- ["testworker", 1]

目前似乎在 bundle exec sidekick -C config/sidekiq.yml 的实例上我只能收听 2 个流中的 1 个。如何让它们同时运行并能够收听它们?

提前致谢

最佳答案

我所要做的就是运行 2 个 sidekiq 进程,1 个使用参数 -q radioworker 运行,1 个使用 -q testworker 运行。抱歉,如果问题描述含糊不清。我试图运行 2 个进程,每个进程有 1 个线程。不是 1 个进程,有 2 个线程。感谢您的帮助

关于ruby-on-rails - 多个工作流 Sidekiq Icecast Rails,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48177698/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com