当前位置: 首页>>代码示例>>PHP>>正文


PHP Api::getQueuedTaskLock方法代码示例

本文整理汇总了PHP中Api::getQueuedTaskLock方法的典型用法代码示例。如果您正苦于以下问题:PHP Api::getQueuedTaskLock方法的具体用法?PHP Api::getQueuedTaskLock怎么用?PHP Api::getQueuedTaskLock使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Api的用法示例。


在下文中一共展示了Api::getQueuedTaskLock方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: sleep

            if ($task) {
                $api->setTaskFailedUnlock($task["id"]);
            }
            exit;
            break;
    }
}
pcntl_signal(SIGTERM, "sig_handler");
pcntl_signal(SIGHUP, "sig_handler");
pcntl_signal(SIGINT, "sig_handler");
pcntl_signal(SIGQUIT, "sig_handler");
while (true) {
    // Cleanup daemons from this host
    $api->cleanupQueueLocks();
    // Search for a task
    $task = $api->getQueuedTaskLock(array(TASK_SEND_METADATA, TASK_SEND_TRANSCODE, TASK_SEND_METADATAERROR));
    if (!$task) {
        // we sleep for a little while, thanks to that, we can launch that process as soon as we want:
        // it will still do *nothing* for a little while when there is nothing to do ;)
        $api->log(LOG_DEBUG, "Nothing to do, sleeping...");
        sleep(60);
        continue;
    }
    $media = $api->mediaSearch(array("id" => $task["mediaid"]));
    if (!$media) {
        $api->log(LOG_CRIT, "Got task '" . $task["id"] . "' but media '" . $task["mediaid"] . "' not found!!");
        $api->setTaskFailedUnlock($task["id"]);
        continue;
    }
    $media = $media[0];
    $api->me = Users::get($task["user"]);
开发者ID:ninetian,项目名称:omk-server,代码行数:31,代码来源:api.daemon.php

示例2: sleep

            if ($task) {
                $api->setTaskFailedUnlock($task["id"]);
            }
            exit;
            break;
    }
}
pcntl_signal(SIGTERM, "sig_handler");
pcntl_signal(SIGHUP, "sig_handler");
pcntl_signal(SIGINT, "sig_handler");
pcntl_signal(SIGQUIT, "sig_handler");
while (true) {
    // Cleanup daemons from this host
    $api->cleanupQueueLocks();
    // Search for a task
    $task = $api->getQueuedTaskLock(TASK_DOWNLOAD, "http");
    if (!$task) {
        // we sleep for a little while, thanks to that, we can launch that process as soon as we want:
        // it will still do *nothing* for a little while when there is nothing to do ;)
        $api->log(LOG_DEBUG, "Nothing to do, sleeping...");
        sleep(60);
        continue;
    }
    $media = $api->mediaSearch(array("id" => $task["mediaid"]));
    if (!$media) {
        $api->log(LOG_CRIT, "got task '" . $task["id"] . "' but media '" . $task["mediaid"] . "' not found");
        $api->setTaskFailedUnlock($task["id"]);
        continue;
    }
    $media = $media[0];
    $api->me = Users::get($task["user"]);
开发者ID:ninetian,项目名称:omk-server,代码行数:31,代码来源:downloader.daemon.php

示例3: sleep

            }
            exit;
            break;
    }
    echo "oups";
}
pcntl_signal(SIGTERM, "sig_handler");
pcntl_signal(SIGHUP, "sig_handler");
pcntl_signal(SIGINT, "sig_handler");
pcntl_signal(SIGQUIT, "sig_handler");
$all_settings = $api->getAllSettings();
while (true) {
    // Cleanup daemons from this host
    $api->cleanupQueueLocks();
    // Search for a task
    $task = $api->getQueuedTaskLock(TASK_DO_TRANSCODE);
    if (!$task) {
        // we sleep for a little while, thanks to that, we can launch that process as soon as we want:
        // it will still do *nothing* for a little while when there is nothing to do ;)
        $api->log(LOG_DEBUG, "Nothing to do, sleeping...");
        sleep(60);
        continue;
    }
    // Get the task's parameters */
    $params = $task["params"];
    $media = $api->mediaSearch(array("id" => $task["mediaid"]));
    if (!$media) {
        $api->log(LOG_CRIT, "Got task '" . $task["id"] . "' but media '" . $task["mediaid"] . "' not found!!");
        $api->setTaskFailedUnlock($task["id"]);
        continue;
    }
开发者ID:ninetian,项目名称:omk-server,代码行数:31,代码来源:transcoder.daemon.php

示例4: sleep

                $api->setTaskFailedUnlock($task["id"]);
            }
            exit;
            break;
    }
    echo "oups";
}
pcntl_signal(SIGTERM, "sig_handler");
pcntl_signal(SIGHUP, "sig_handler");
pcntl_signal(SIGINT, "sig_handler");
pcntl_signal(SIGQUIT, "sig_handler");
while (true) {
    // Cleanup daemons from this host
    $api->cleanupQueueLocks();
    // Search for a task
    $task = $api->getQueuedTaskLock(TASK_DO_METADATA);
    if (!$task) {
        // we sleep for a little while, thanks to that, we can launch that process as soon as we want:
        // it will still do *nothing* for a little while when there is nothing to do ;)
        $api->log(LOG_DEBUG, "Nothing to do, sleeping...");
        sleep(60);
        continue;
    }
    // Get the task's parameters */
    $params = unserialize($task["params"]);
    $media = $api->mediaSearch(array("id" => $task["mediaid"]));
    if (!$media) {
        $api->log(LOG_CRIT, "Got task '" . $task["id"] . "' but media '" . $task["mediaid"] . "' not found!!");
        $api->setTaskFailedUnlock($task["id"]);
        continue;
    }
开发者ID:ninetian,项目名称:omk-server,代码行数:31,代码来源:metadata.daemon.php

示例5: exit

 * or wait 10 seconds if no download is queued.
 */
if (!function_exists("curl_init")) {
    error_log("php-curl not installed or not enabled, exit.\n");
    exit(1);
}
require_once __DIR__ . '/../../common.php';
require_once MODULES . '/api/libs/api.php';
$useragent = "OpenMediaKit-Transcoder/" . OMKT_VERSION . " (Download Daemon)";
$api = new Api();
$api->log_caller = "dummy-download-daemon";
while (true) {
    // Cleanup daemons from this host
    $api->cleanupQueueLocks();
    // Search for a task
    $task = $api->getQueuedTaskLock(TASK_DOWNLOAD, "dummy");
    if (!$task) {
        // we sleep for a little while, thanks to that, we can launch that process as soon as we want:
        // it will still do *nothing* for a little while when there is nothing to do ;)
        $api->log(LOG_DEBUG, "Nothing to do, sleeping...");
        sleep(60);
        continue;
    }
    $media = $api->mediaSearch(array("id" => $task["mediaid"]));
    if (!$media) {
        $api->log(LOG_CRIT, "got task '" . $task["id"] . "' but media '" . $task["mediaid"] . "' not found");
        $api->setTaskFailedUnlock($task["id"]);
        continue;
    }
    $media = $media[0];
    // ok, we try to download the file, with curl, with timeout and range management
开发者ID:ninetian,项目名称:omk-server,代码行数:31,代码来源:daemon.php


注:本文中的Api::getQueuedTaskLock方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。