public function stop(int $delay = 10): void
    {
        $delay = 0 >= $delay ? 1 : $delay;

        /** @psalm-suppress MixedTypeCoercion Incorrect amphp types */
        Loop::defer(
            function() use ($delay): \Generator
            {
                yield $this->transport->stop();

                $this->logger->info('Handler will stop after {duration} seconds', ['duration' => $delay]);

                /** @psalm-suppress MixedTypeCoercion Incorrect amphp types */
                Loop::delay(
                    $delay * 1000,
                    function(): void
                    {
                        $this->logger->info('The event loop has been stopped');

                        Loop::stop();
                    }
                );
            }
        );
    }
public function stop(int $delay = 10): void
    {
        $delay = 0 >= $delay ? 1 : $delay;

        /** @psalm-suppress MixedTypeCoercion Incorrect amphp types */
        Loop::defer(
            function() use ($delay): \Generator
            {
                yield $this->transport->stop();

                $this->logger->info('Handler will stop after {duration} seconds', ['duration' => $delay]);

                /** @psalm-suppress MixedTypeCoercion Incorrect amphp types */
                Loop::delay(
                    $delay * 1000,
                    function(): void
                    {
                        $this->logger->info('The event loop has been stopped');

                        Loop::stop();
                    }
                );
            }
        );
    }
public function stop ( int $ delay = 10 ) : void { $ delay = 0 >= $ delay ? 1 : $ delay ; /** @psalm-suppress MixedTypeCoercion Incorrect amphp types */ Loop :: defer ( function ( ) use ( $ delay ) : \ Generator { yield $ this -> transport -> stop ( ) ; $ this -> logger -> info ( 'Handler will stop after {duration} seconds' , [ 'duration' => $ delay ] ) ; /** @psalm-suppress MixedTypeCoercion Incorrect amphp types */ Loop :: delay ( $ delay * 1000 , function ( ) : void { $ this -> logger -> info ( 'The event loop has been stopped' ) ; Loop :: stop ( ) ; } ) ; } ) ; }
Unsubscribe all queues.
Terminates the subscription and stops the daemon after the specified number of seconds.

@param int $delay The delay before the completion (in seconds)

@return void
Unsubscribe all queues . Terminates the subscription and stops the daemon after the specified number of seconds .