已触发Laravel 5.4事件,但未广播
我对在网站上播放评论有问题: -有时事件侦听器处理事件,但不广播事件 \方法存储中的App\Http\Controllers\CommentController: \App\Events\NewCommentAdded \应用程序\侦听器\广播新内容 在所有这些之后,我得到了日志:已触发Laravel 5.4事件,但未广播,laravel,redis,queue,beanstalkd,broadcasting,Laravel,Redis,Queue,Beanstalkd,Broadcasting,我对在网站上播放评论有问题: -有时事件侦听器处理事件,但不广播事件 \方法存储中的App\Http\Controllers\CommentController: \App\Events\NewCommentAdded \应用程序\侦听器\广播新内容 在所有这些之后,我得到了日志: [2017-12-06 16:02:03] production.INFO: Added New Comment Event fired successfully [2017-12-06 16:02:03] pr
[2017-12-06 16:02:03] production.INFO: Added New Comment Event fired successfully
[2017-12-06 16:02:03] production.INFO: AddComment event broadcasted
[2017-12-06 16:03:23] production.INFO: Added New Comment Event fired successfully
[2017-12-06 16:03:24] production.INFO: AddComment event broadcasted
[2017-12-06 16:03:58] production.INFO: Added New Comment Event fired successfully
[2017-12-06 16:17:26] production.INFO: Added New Comment Event fired successfully
[2017-12-06 16:17:27] production.INFO: AddComment event broadcasted
如您所见,事件侦听器处理的事件:[2017-12-06 16:03:58]production.INFO:添加的新注释事件已成功触发
但该事件并未播出
我的环境:
BROADCAST_DRIVER=redis
QUEUE_DRIVER=beanstalkd
我的主管配置:
[program:ta-production-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /var/www/domains/data/www/somedomain.com/artisan queue:work --daemon --sleep=3 --tries=5
autostart=true
autorestart=true
user=root
numprocs=5
redirect_stderr=true
stdout_logfile=/var/www/domains/data/www/somedomain.com/storage/logs/worker.log
问题的解决办法:
停止使用主管或 降级主管或 升级主管。
我停止使用Supervisor,一切都正常。您是否已将侦听器配置为侦听该事件?这可以在EventServiceProvider.phpof中完成。当然,我在“App\Events\NewCommentAdded”=>[“App\Listeners\BroadcastNewComment”,],“App\Events\CommentDeleted”=>[“App\Listeners\BroadcastDeleteComment”,]中完成,我只是有时会看到问题,不是在每个事件上都会遇到同样的问题,队列驱动程序是beanstalkd,当事件被触发时,作业出现在beanstalkd中,但队列不处理该作业,作业是holdStop using Supervisor
[2017-12-06 16:02:03] production.INFO: Added New Comment Event fired successfully
[2017-12-06 16:02:03] production.INFO: AddComment event broadcasted
[2017-12-06 16:03:23] production.INFO: Added New Comment Event fired successfully
[2017-12-06 16:03:24] production.INFO: AddComment event broadcasted
[2017-12-06 16:03:58] production.INFO: Added New Comment Event fired successfully
[2017-12-06 16:17:26] production.INFO: Added New Comment Event fired successfully
[2017-12-06 16:17:27] production.INFO: AddComment event broadcasted
BROADCAST_DRIVER=redis
QUEUE_DRIVER=beanstalkd
[program:ta-production-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /var/www/domains/data/www/somedomain.com/artisan queue:work --daemon --sleep=3 --tries=5
autostart=true
autorestart=true
user=root
numprocs=5
redirect_stderr=true
stdout_logfile=/var/www/domains/data/www/somedomain.com/storage/logs/worker.log