Move the spawn code out of the poll method.
This commit is contained in:
parent
caca0b1398
commit
d020c0c9bf
@ -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
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user