vendor/codeages/biz-framework/src/Scheduler/Service/JobPool.php
(开头部分) 1KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
namespace Codeages\Biz\Framework\Scheduler\Service;
use Codeages\Biz\Framework\Scheduler\Job;
use Codeages\Biz\Framework\Targetlog\Service\TargetlogService;
use Codeages\Biz\Framework\Util\ArrayToolkit;
class JobPool
{
private $options = array();
private $biz;
const SUCCESS = 'success';
const POOL_FULL = 'pool_full';
public function __construct($biz)
{
$this->biz = $biz;
$this->options = $biz['scheduler.options'];
}
public function execute(Job $job)
{
if ($this->isFull($job)) {
return static::POOL_FULL;
}
$result = '';
try {
$result = $job->execute();
} catch (\Exception $e) {
$this->release($job);
throw $e;
}
$this->release($job);
if (empty($result)) {
return static::SUCCESS;
}
return $result;
}
public function getJobPool($name = 'default')
{
return $this->getJobPoolDao()->getByName($name);
}
public function release($job)
{
$jobPool = $this->getJobPool($job['pool']);
$lockName = "job_pool.{$jobPool['name']}";
$this->biz['lock']->get($lockName, 10);
$this->wavePoolNum($jobPool['id'], -1);
$this->biz['lock']->release($lockName);
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。