sync 更新--这已经缩小到了 works
在我的生产环境中试图运行排队命令时,我收到了以下错误:
exception 'ErrorException' with message 'unserialize(): Function spl_autoload_call() hasn't defined the class it was called for'
in /home/forge/default/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php:74我试过beanstalkd和数据库驱动程序,没有改变。为了简单起见,我使用以下命令:
<?php namespace App\Commands;
use App\Commands\Command;
use App\User;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Bus\SelfHandling;
use Illuminate\Contracts\Queue\ShouldBeQueued;
class TestQueueCommand extends Command implements SelfHandling, ShouldBeQueued {
use InteractsWithQueue, SerializesModels;
/**
* @var User
*/
private $user;
/**
* Create a new command instance.
*
* @param User $user
*/
public function __construct(User $user)
{
//
$this->user = $user;
}
/**
* Execute the command.
*
* @return void
*/
public function handle()
{
\Log::info("You gave me " . $this->user->fullName());
}
}调度代码:
get('queue-test', function()
{
Bus::dispatch(new TestQueueCommand(User::first()));
});这工作在我的家园环境,在生产失败(数字海洋,锻造)。我有几个养猪场的工人,我试着重新启动他们。我还运行过php artisan queue:flush。
下面是发生错误的代码(来自源代码):
/**
* Handle the queued job.
*
* @param \Illuminate\Contracts\Queue\Job $job
* @param array $data
* @return void
*/
public function call(Job $job, array $data)
{
$command = $this->setJobInstanceIfNecessary(
$job, unserialize($data['command'])
);
$this->dispatcher->dispatchNow($command, function($handler) use ($job)
{
$this->setJobInstanceIfNecessary($job, $handler);
});
if ( ! $job->isDeletedOrReleased())
{
$job->delete();
}
}发布于 2015-04-16 21:29:29
在过去,我在不序列化的时候也遇到了类似的问题。问题是默认Bean秸秆作业大小(65,535字节),如果被序列化的类包含许多需要保留的属性(增加序列化字符串的大小,并使用大于65K的存储),则可能不够大。
为了解决这个问题,尝试使用-z选项将配置文件(/etc/default/beanstalkd)上的大小设置为131,072字节,甚至262,144个字节:
BEANSTALKD_EXTRA="-z 262144"
在此之后,您应该重新启动服务。
还请注意,配置文件路径可能是其他路径,这取决于您使用的发行版。
由于您使用的是数字海洋,您可能会发现他们的文档很有用。
https://stackoverflow.com/questions/29435606
复制相似问题