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
1 changed files with 29 additions and 25 deletions

View File

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