lib/async/container/group.rb in async-container-0.16.3 vs lib/async/container/group.rb in async-container-0.16.4
- old
+ new
@@ -79,17 +79,16 @@
fiber.resume(Terminate)
end
end
def stop(timeout = 1)
- # Handle legacy `graceful = true` argument:
+ # Use a default timeout if not specified:
+ timeout = 1 if timeout == true
+
if timeout
start_time = Async::Clock.now
- # Use a default timeout if not specified:
- timeout = 1 if timeout == true
-
self.interrupt
while self.any?
duration = Async::Clock.now - start_time
remaining = timeout - duration
@@ -100,17 +99,9 @@
self.wait_for_children(0)
break
end
end
end
-
- # Timeout can also be `graceful = false`:
- if timeout
- self.interrupt
- self.sleep(timeout)
- end
-
- self.wait_for_children(duration)
# Terminate all children:
self.terminate
# Wait for all children to exit: