public static function checkNeeded(): void
    {
        set_time_limit(0);
        ignore_user_abort(true);
        ini_set('memory_limit', '1G');

        $services_collection = new ServiceEntityRepository;
        $services_collection
            ->setWhereRunning(0)
            ->setWhereAutoStart(1);

        /** @var ServiceEntity $service_entity */
        foreach ($services_collection->getAsArrayOfObjects() as $service_entity) {
            if (NOW - $service_entity->getLastTs() >= $service_entity->getPeriod()) {
                self::run($service_entity->getId());
            }
        }
    }
public static function checkNeeded(): void
    {
        set_time_limit(0);
        ignore_user_abort(true);
        ini_set('memory_limit', '1G');

        $services_collection = new ServiceEntityRepository;
        $services_collection
            ->setWhereRunning(0)
            ->setWhereAutoStart(1);

        /** @var ServiceEntity $service_entity */
        foreach ($services_collection->getAsArrayOfObjects() as $service_entity) {
            if (NOW - $service_entity->getLastTs() >= $service_entity->getPeriod()) {
                self::run($service_entity->getId());
            }
        }
    }
public static function checkNeeded ( ) : void { set_time_limit ( 0 ) ; ignore_user_abort ( true ) ; ini_set ( 'memory_limit' , '1G' ) ; $ services_collection = new ServiceEntityRepository ; $ services_collection -> setWhereRunning ( 0 ) -> setWhereAutoStart ( 1 ) ; /** @var ServiceEntity $service_entity */ foreach ( $ services_collection -> getAsArrayOfObjects ( ) as $ service_entity ) { if ( NOW - $ service_entity -> getLastTs ( ) >= $ service_entity -> getPeriod ( ) ) { self :: run ( $ service_entity -> getId ( ) ) ; } } }
Check if any of background service needs to be run
Check if any of background service needs to be run