src/php/Arbit/Periodic/Executor.php
public function run()
    {
        if ( ( $lastRun = $this->getLastRun() ) === false )
        {
            $this->storeLastRun();
            $lastRun = 0;
        }

        $tasks = $this->getJobsSince( $lastRun );
        if ( count( $tasks ) &&
             $this->aquireLock() )
        {
            $this->storeLastRun();
            $this->executeTasks( $tasks );
            $this->releaseLock();
        }
    }
public function run()
    {
        if ( ( $lastRun = $this->getLastRun() ) === false )
        {
            $this->storeLastRun();
            $lastRun = 0;
        }

        $tasks = $this->getJobsSince( $lastRun );
        if ( count( $tasks ) &&
             $this->aquireLock() )
        {
            $this->storeLastRun();
            $this->executeTasks( $tasks );
            $this->releaseLock();
        }
    }
public function run ( ) { if ( ( $ lastRun = $ this -> getLastRun ( ) ) === false ) { $ this -> storeLastRun ( ) ; $ lastRun = 0 ; } $ tasks = $ this -> getJobsSince ( $ lastRun ) ; if ( count ( $ tasks ) && $ this -> aquireLock ( ) ) { $ this -> storeLastRun ( ) ; $ this -> executeTasks ( $ tasks ) ; $ this -> releaseLock ( ) ; } }
Execute executor

This method will check if there are any tasks to be run since the last
check. If this is the first check no tasks will be executed.

If there are tasks to execute the method will try to aquire a lock, to
ensure that not multiple executors try to execute the same task. If it
fails to aquire a lock it will exit and check again the next time
called.

If the lock could successfully be aquired it will run all scheduled
tasks in order and release the lock afterwards.

@return void
Execute executor