public function stopAfter(int $seconds): self
    {
        $seconds = 0 >= $seconds ? 1 : $seconds;

        /** @psalm-suppress MixedTypeCoercion Incorrect amphp types */
        Loop::delay(
            $seconds * 1000,
            function() use ($seconds): void
            {
                /** @var LoggerInterface $logger */
                $logger = $this->getKernelContainerService('service_bus.logger');

                $logger->info('The demon\'s lifetime has expired ({lifetime} seconds)', ['lifetime' => $seconds]);

                $this->entryPoint->stop();
            }
        );

        return $this;
    }
public function stopAfter(int $seconds): self
    {
        $seconds = 0 >= $seconds ? 1 : $seconds;

        /** @psalm-suppress MixedTypeCoercion Incorrect amphp types */
        Loop::delay(
            $seconds * 1000,
            function() use ($seconds): void
            {
                /** @var LoggerInterface $logger */
                $logger = $this->getKernelContainerService('service_bus.logger');

                $logger->info('The demon\'s lifetime has expired ({lifetime} seconds)', ['lifetime' => $seconds]);

                $this->entryPoint->stop();
            }
        );

        return $this;
    }
public function stopAfter ( int $ seconds ) : self { $ seconds = 0 >= $ seconds ? 1 : $ seconds ; /** @psalm-suppress MixedTypeCoercion Incorrect amphp types */ Loop :: delay ( $ seconds * 1000 , function ( ) use ( $ seconds ) : void { /** @var LoggerInterface $logger */ $ logger = $ this -> getKernelContainerService ( 'service_bus.logger' ) ; $ logger -> info ( 'The demon\'s lifetime has expired ({lifetime} seconds)' , [ 'lifetime' => $ seconds ] ) ; $ this -> entryPoint -> stop ( ) ; } ) ; return $ this ; }
Shut down after N seconds.

@param int $seconds

@return self
Shut down after N seconds .