Model/Cron.php
private function jobHasAlreadyBeenRun($jobCode)
    {
        $currentRunningJob = $this->cronCollection->create()
            ->addFieldToFilter('job_code', $jobCode)
            ->addFieldToFilter('status', 'running')
            ->setPageSize(1);

        if ($currentRunningJob->getSize()) {
            $jobOfSameTypeAndScheduledAtDateAlreadyExecuted =  $this->cronCollection->create()
                ->addFieldToFilter('job_code', $jobCode)
                ->addFieldToFilter('scheduled_at', $currentRunningJob->getFirstItem()->getScheduledAt())
                ->addFieldToFilter('status', ['in' => ['success', 'failed']]);

            return ($jobOfSameTypeAndScheduledAtDateAlreadyExecuted->getSize()) ? true : false;
        }

        return false;
    }
private function jobHasAlreadyBeenRun($jobCode)
    {
        $currentRunningJob = $this->cronCollection->create()
            ->addFieldToFilter('job_code', $jobCode)
            ->addFieldToFilter('status', 'running')
            ->setPageSize(1);

        if ($currentRunningJob->getSize()) {
            $jobOfSameTypeAndScheduledAtDateAlreadyExecuted =  $this->cronCollection->create()
                ->addFieldToFilter('job_code', $jobCode)
                ->addFieldToFilter('scheduled_at', $currentRunningJob->getFirstItem()->getScheduledAt())
                ->addFieldToFilter('status', ['in' => ['success', 'failed']]);

            return ($jobOfSameTypeAndScheduledAtDateAlreadyExecuted->getSize()) ? true : false;
        }

        return false;
    }
private function jobHasAlreadyBeenRun ( $ jobCode ) { $ currentRunningJob = $ this -> cronCollection -> create ( ) -> addFieldToFilter ( 'job_code' , $ jobCode ) -> addFieldToFilter ( 'status' , 'running' ) -> setPageSize ( 1 ) ; if ( $ currentRunningJob -> getSize ( ) ) { $ jobOfSameTypeAndScheduledAtDateAlreadyExecuted = $ this -> cronCollection -> create ( ) -> addFieldToFilter ( 'job_code' , $ jobCode ) -> addFieldToFilter ( 'scheduled_at' , $ currentRunningJob -> getFirstItem ( ) -> getScheduledAt ( ) ) -> addFieldToFilter ( 'status' , [ 'in' => [ 'success' , 'failed' ] ] ) ; return ( $ jobOfSameTypeAndScheduledAtDateAlreadyExecuted -> getSize ( ) ) ? true : false ; } return false ; }
Check if already ran for same time

@param string $jobCode
@return bool
Check if already ran for same time