Пример #1
0
                $onecron["url"] .= "&action=transcoder_cron&app_key=" . $onecron['clientkey'];
            } else {
                $onecron["url"] .= "?action=transcoder_cron&app_key=" . $onecron['clientkey'];
            }
            $urllist[] = array("url" => $onecron["url"], "uid" => $onecron["uid"]);
        }
    }
    if (empty($urllist)) {
        // nothing to do :
        sleep(60);
        // Let's try again in a minute
        continue;
    }
    $api->log(LOG_INFO, "Launching " . count($urllist) . " cron calls");
    // cron_callback($url, $content, $curlobj) will be called at the end of each http call.
    $cron->rolling_curl($urllist, "cron_callback");
}
// while true
function cron_callback($url, $content, $curl)
{
    global $cron, $api;
    $api->log(LOG_DEBUG, "return from cron call for url " . implode(":", $url) . " has http_code " . $curl["http_code"]);
    if (empty($url["uid"])) {
        return;
    }
    // not normal...
    if ($curl["http_code"] == 200) {
        $cron->cronCallOk($url["uid"]);
    } else {
        $cron->cronCallFailed($url["uid"]);
    }