Two threads in a rails initializer file seems to not run them properly
- by Luccas
Initially I was using one thread to listen a queue from amazon and works perfectly.
aws.rb
Thread.new do
queue1 = AWS::SQS::Queue.new(SQSADDR['my_queue'])
queue1.poll do |msg|
...
but now I appended another thread to listen another queue:
...
Thread.new do
queue2 = AWS::SQS::Queue.new(SQSADDR['my_another_queue'])
queue2.poll do |msg|
...
and now it seems to not work. Only the last one receives response...
I have to join the threads? I can't understand
What is going on?