laravel 5.1 在 VM 重新启动的情况下看不到作业文件的更改

laravel 5.1 not seeing changes to Job file without VM restart

我在 laravel 5.1 应用程序中创建了一个新作业,运行ning 在 Homestead VM 中。我已将其设置为排队并在 handle 方法中包含代码。

handle() 方法之前需要传递参数,但不再需要,我已经从 handle 方法中删除了参数。

但是,当队列 运行 是作业时,我收到一条错误消息:

[2015-06-17 14:08:46] local.ERROR: exception 'ErrorException' with message 'Missing argument 1 for Simile\Jobs\SpecialJob::handle()' in /home/vagrant/Code/BitBucket/simile-app/app/Jobs/SpecialJob.php:31

该文件的第 31 行是:

public function handle()

它不再需要任何参数,除非有一个未记录的默认参数。

现在我所做的任何更改,包括注释掉作业文件中的所有内容,当我 运行 队列时都看不到。我仍然会得到同样的错误。

我试过重新启动 nginxphp5-fpmsupervisorbeanstalkd 和 运行ning:artisan cache:clearartisan clear-compiled, artisan optimize, composer dumpautoload

没有任何效果。

我要 laravel 查看对作业文件的任何更新的唯一方法是重新启动 VM。 vagrant halt,然后 vagrant up

作业在控制台命令中触发,如下所示:

$this->dispatch(new SpecialJob($site->id));

这里是 SpecialJob.php 文件的完整代码:

http://laravel.io/bin/qQQ3M#5

我尝试创建另一个新作业并进行测试,我得到了相同的结果。

所有其他非工作文件立即更新,没问题。它只是作业文件。就像一个旧副本被缓存在我找不到的地方。

当 运行 队列工作器 as a daemon 时,您必须告诉工作器在代码更改后重新启动。

Since daemon queue workers are long-lived processes, they will not pick up changes in your code without being restarted. So, the simplest way to deploy an application using daemon queue workers is to restart the workers during your deployment script. You may gracefully restart all of the workers by including the following command in your deployment script:

php artisan queue:restart