Move the spawn code out of the poll method.

This commit is contained in:
Danila Fedorin 2018-01-12 22:07:32 -08:00
parent caca0b1398
commit d020c0c9bf

View File

@ -84,9 +84,7 @@ module Telepathy
end end
end end
def poll private def spawn_workers
if !@poll_running
@poll_running = true
spawn do spawn do
loop do loop do
action = @poll_channel.receive action = @poll_channel.receive
@ -113,6 +111,12 @@ module Telepathy
end end
end end
end end
def poll
if !@poll_running
@poll_running = true
spawn_workers
end
@poll_channel.send nil @poll_channel.send nil
end end