Thinkphp-queue中exceeded the timeout of 60 seconds 的问题 以及运行队列报错count(): Parameter must be an array or an object that implements Countable的解决方法
Thinkphp-queue中exceeded the timeout of 60 seconds 的问题
修改代码 vendor/topthink/think-queue/src/queue/command/Listen.php line 25~35
public function configure()
{
$this->setName('queue:listen')
->addOption('queue', null, Option::VALUE_OPTIONAL, 'The queue to listen on', null)
->addOption('delay', null, Option::VALUE_OPTIONAL, 'Amount of time to delay failed jobs', 0)
->addOption('memory', null, Option::VALUE_OPTIONAL, 'The memory limit in megabytes', 256) //修改占用内存大小
->addOption('timeout', null, Option::VALUE_OPTIONAL, 'Seconds a job may run before timing out', 1200) //修改超时时间
->addOption('sleep', null, Option::VALUE_OPTIONAL, 'Seconds to wait before checking queue for jobs', 3)
->addOption('tries', null, Option::VALUE_OPTIONAL, 'Number of times to attempt a job before logging it failed', 0)
->setDescription('Listen to a given queue');
}
运行队列报错count(): Parameter must be an array or an object that implements Countable的解决方法
thinkphp/library/think/process/pipes/Windows.php 修改代码 line 199~221
if (null !== $w && 0 < is_array($r)?count($r):0) {
$data = '';
while ($dataread = fread($r['input'], self::CHUNK_SIZE)) {
$data .= $dataread;
}
$this->inputBuffer .= $data;
if (false === $data || (true === $close && feof($r['input']) && '' === $data)) {
$this->input = null;
}
}
if (null !== $w && 0 < is_array($w) ? count($w):0) {
while (strlen($this->inputBuffer)) {
$written = fwrite($w[0], $this->inputBuffer, 2 << 18);
if ($written > 0) {
$this->inputBuffer = (string) substr($this->inputBuffer, $written);
} else {
break;
}
}
}