Skip to content

Instantly share code, notes, and snippets.

@asssis
Last active May 30, 2021 13:47
Show Gist options
  • Save asssis/b2d091f9f4cb528229aa5f2b741103aa to your computer and use it in GitHub Desktop.
Save asssis/b2d091f9f4cb528229aa5f2b741103aa to your computer and use it in GitHub Desktop.
gerenciar processos por thread
array.each do |x|
puts '----------iniciando novo processo------------'
thread << Thread.new do
begin
Timeout::timeout(60 * 10) do
executar_processo(malha)
end
rescue
end
end
while(thread.select{|x| !x.blank? && x.status}.length >= 3)
sleep(10)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment