Ejemplo n.º 1
0
 public static function loadWorkers()
 {
     $workers = Loader::getInstance()->config();
     defined('PHPKIT_RUN_DEBUG') && syslog(LOG_INFO, 'load config success');
     foreach ($workers as $worker) {
         for ($i = 1; $i <= $worker['processNum']; $i++) {
             self::createWorkerProcess($worker['className'], $i, $worker);
         }
     }
 }
Ejemplo n.º 2
0
 public static function loadConfig()
 {
     $time = time();
     $config = Loader::getInstance()->config();
     foreach ($config as $id => $task) {
         $ret = ParseCrontab::parse($task["rule"], $time);
         //defined('PHPKIT_RUN_DEBUG') && syslog(LOG_DEBUG,var_export($ret,true));
         if ($ret === false) {
             syslog(LOG_ERR, ParseCrontab::$error);
         } elseif (!empty($ret)) {
             TickTable::set_task($ret, array_merge($task, array("id" => $id)));
         }
     }
 }