1
votes

Wondering why I can only have 1 stream listening on a specific port on sidekiq/redis/icecast Rails Stream app. My files are as following:

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 workers on 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 

both workers have been set to perform async in initializer/sidekiq.rb and I have the sidekiq queues defined in config/sidekiq.yml

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

Currently It seems as if on an instance of bundle exec sidekick -C config/sidekiq.yml I can only listen to 1 of the 2 streams. How can I have them both running at the same time and be able to listen to them?

Thanks in advance

1
Your question is a little vague because we don't know how you're ingesting the feeds. And, admittedly, I know very little about Icecast but make sure you're running things in a multi-threaded environment, both in your Sidekiq instance and Rails server. github.com/mperham/sidekiq/wiki/Advanced-Options and stackoverflow.com/questions/17902386/… for more info.Josh Brody
What does "2 workers on rails" mean? 2 processes? 1 process with 2 threads? Further, why Sidekiq? Your description sounds like you need a persistent connection. Why not run a Ruby process, use fork and spawn sub-processes that connect to the icecast endpoints?Srdjan Pejic

1 Answers

0
votes

All I had to do was run 2 sidekiq processes 1 running with the params -q radioworker and 1 running with -q testworker. Sorry if the problem description was vague.I was trying to run 2 processes with 1 thread each.Not 1 process with 2 threads. Thanks for the help