Exemple #1
0
 public function testUnsupportedEngineType()
 {
     $this->setExpectedException('Edo_Event_Engine_Exception');
     $config = array();
     $config['type'] = 'moo';
     $moo = Edo_Event_Engine_Factory::build($config);
 }
 public static function getNewFileEngine()
 {
     $config = array();
     $config['base_path'] = dirname(__FILE__) . "/data";
     $config['type'] = 'file';
     return Edo_Event_Engine_Factory::build($config);
 }
if ($fullLock) {
    if (is_file($fullLockPath)) {
        $lock_time = file_get_contents($fullLockPath);
        $currentLockTime = time() - $lock_time;
        if ($currentLockTime > $fullLockWarningTime) {
            echo "Full lock of worker {$worker_name} is not released for {$currentLockTime} seconds while the warning time is {$fullLockWarningTime} seconds. Might wanna have a look wassup." . PHP_EOL;
        }
        exit;
        //file is locked....some other worker of this name already working
    } else {
        //ackuire full lock
        file_put_contents($fullLockPath, time());
    }
}
//creating engine
$engine = Edo_Event_Engine_Factory::build($config['engine']);
Edo_Event_Engine::setDefaultEngine($engine);
//start timer
$start_time = time();
$elapsed_time = 0;
do {
    try {
        $failed = false;
        //check elapsed time
        $elapsed_time = time() - $start_time;
        if ($elapsed_time > $limit_time) {
            break;
        }
        $event = $engine->getFreeEvent($pool);
        if (!$event) {
            break;
Exemple #4
0
 protected function _getNewInstance($config = null)
 {
     $config['type'] = 'file';
     return Edo_Event_Engine_Factory::build($config);
 }