2015-04-03 126 views
2

更新 - 這已經被縮小到beanstalkd,sync工作Laravel 5 - 排隊命令拋spl_autoload_call()錯誤

我收到試圖在我的生產環境中運行排隊的命令時,出現以下錯誤:

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())); 
}); 

此作品在我的家園環境,未能在生產(數字海洋,鍛造)。我有幾個beanstalkd工人,我試圖重新啓動它們。我也跑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(); 
     } 
    } 
+0

沒人?現在的解決方案:iron.io:/ – NightMICU 2015-04-03 21:05:40

回答