ruby on rails - RoR not getting last query in thread -


i trying make twitch.tv alert shows streamer follow goes live.

when user add twitch channel follow goes database. when tried channels on database in thread loop it's not getting last channel. puts @server giving 11 results(all results) in loop getting 10 results.

require "rest-client" require "json" puts "sunucular aktifleştiriliyor" thr = thread.new   loop     online = {}     online.default = 0     @server = server.all     puts @server     @server.each |a|       cevap = restclient.get("https://api.twitch.tv/kraken/streams/#{a.name}", headers={'client-id': 'api-id'})       puts "parsing"       icerik = json.parse(cevap)       puts online       if icerik['stream'] != nil         online[a.name] += 1       else         online[a.name] = 0       end     end     sleep(10)    end end puts "second thread starting" 


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -