Laravel无法修改排队的作业代码 [英] Laravel unable to modify queued job code

查看:103
本文介绍了Laravel无法修改排队的作业代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我发送由于诸如'ErrorException' with message 'Undefined variable: sender'之类的异常而失败的作业并修复代码并重新触发该事件时,先前的代码将再次运行,并且会出现相同的错误.

When I send a job that fails due to an exception such as 'ErrorException' with message 'Undefined variable: sender' and I fix the code and re-fire the event, the previous code runs again and I get the same error.

我不知道为什么Laravel一遍又一遍地重新运行我的旧代码.我显然希望能够解决破坏我的工作执行的错误.

I have no idea why Laravel re-runs my old code over and over. I'd obviously like to be able to fix the mistakes that are breaking my job execution.

我已经尝试了composer dump-autoloadphp artisan queue:flush,但都没有效果.有帮助吗?

I've tried both composer dump-autoload and php artisan queue:flush and those have no effect. Any help?

推荐答案

您需要运行php artisan clear-compiled清除已编译的文件.

You need to run php artisan clear-compiled to clear compiled files.

如果您查看config/compile.php,您将看到Laravel默认会缓存一些额外的提供程序(或其他类).

If you look at config/compile.php you will see some extra providers (or other classes) are cached by default by Laravel.

例如,如果您在EventServiceProvider中进行了任何更改并且已被更早地缓存,则在早期启动php artisan optimize命令的情况下,Laravel将不会看到这些更改(并查看

If you made any changes for example in EventServiceProvider and it was earlier cached, Laravel won't see those changes in case php artisan optimize command was earlier launched (and looking at https://github.com/laravel/laravel/blob/master/composer.json you will see it is launched after running composer install or composer update).

此功能与composer本身没有任何共同之处,但与Laravel相同,这就是为什么运行composer dump-autoload不能提供帮助的原因.

This feature has nothing in common with composer itself but with Laravel that's why running composer dump-autoload won't help.

这篇关于Laravel无法修改排队的作业代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆