class Async::Container::Group
def stop(graceful = true, interrupt_timeout: INTERRUPT_TIMEOUT, terminate_timeout: TERMINATE_TIMEOUT)
@parameter interrupt_timeout [Numeric | Nil] Time to wait after SIGINT before escalating to SIGTERM.
@parameter graceful [Boolean] Whether to send SIGINT first or skip directly to SIGTERM.
If `graceful` is false, skips the SIGINT phase and goes directly to SIGTERM → SIGKILL.
3. Send SIGKILL and wait indefinitely for process cleanup
2. Send SIGTERM and wait up to `terminate_timeout` seconds
1. Send SIGINT and wait up to `interrupt_timeout` seconds
A graceful shutdown performs the following sequence:
Stop all child processes with a multi-phase shutdown sequence.
def stop(graceful = true, interrupt_timeout: INTERRUPT_TIMEOUT, terminate_timeout: TERMINATE_TIMEOUT) case graceful when true # Use defaults. when false interrupt_timeout = nil when Numeric interrupt_timeout = graceful terminate_timeout = graceful end Console.debug(self, "Stopping all processes...", interrupt_timeout: interrupt_timeout, terminate_timeout: terminate_timeout) # If a timeout is specified, interrupt the children first: if interrupt_timeout clock = Async::Clock.start # Interrupt the children: self.interrupt # Wait for the children to exit: self.wait_for_exit(clock, interrupt_timeout) end if terminate_timeout and self.any? clock = Async::Clock.start # If the children are still running, terminate them: self.terminate # Wait for the children to exit: self.wait_for_exit(clock, terminate_timeout) end if any? self.kill self.wait end end