Пример #1
0
 public static function receive_queue($class = '')
 {
     $queue = Com_Queued::receive_byrpop(self::$rep_queue . ($class ? ":" . $class : ""));
     if ($queue) {
         return json_decode($queue, true);
     } else {
         return false;
     }
 }
Пример #2
0
//上次domain执行时间
$damonRunTime = 0;
$damonCheckLife = 30;
//进程列表
$processList = array();
$processUpdateTime = 0;
$processUpdateLife = 300;
//每日已经启动进程LIST 避免没有启动
$redis = Com_AdCache::factory();
$dateKey = date('Y-m-d');
$processRunList = array();
$processRunList[$dateKey] = $objProcess->getRunStat($dateKey);
$firstLoop = true;
while (true) {
    $restart = false;
    if ($restart = Com_Queued::receive_byrpop("process")) {
        # 从队列process表尾获取元素,返回nil或者队列名与元素组成的数组
        $processList = $objProcess->getProcessList();
        foreach ($processList as $process) {
            if ($process['process_interval']) {
                continue;
            }
            if (!$mainProcess && $process['process_flag']) {
                continue;
            }
            if (!IS_CSBATTLE && $process['process_flag'] == 2) {
                continue;
            }
            Process_Server::killProcess(PROCESS_PATH . '/' . $process['process_file'], CLI_PATH);
            //			exec("sudo -u nobody /usr/local/webserver/php/bin/php ".PROJECT_ROOT."/test/tools/MakeCacheFile.php");
            //			exec("sudo -u nobody /usr/local/webserver/php/bin/php ".PROJECT_ROOT."/test/tools/generate_cache.php");