when using laravel queue job processing, getting stuck

拟墨画扇 提交于 2019-12-01 09:11:34

It is probably one of two things:

1. Memory Leak

If you are running your queues as a daemon process, then it is possible that over time they will run out of memory. If this occurs, you have three choices.

  • Find a stop the memory leak
  • Switch to using queue:listen to ensure PHP restarts each time
  • Run a scheduler that includes $schedule->command('queue:restart')->hourly(). This gives you the best of both worlds, because you get the benefit of a daemon process, and just restart it once an hour to allow PHP to reset.

2. Failed database connection

There is currently a known issue that if a DB connection goes away during a daemon process, it may not reconnect. A PR is in process here - so check if this gets accepted and the bug should be fixed: https://github.com/laravel/framework/pull/19080

Monitoring

If you want to know your queues are always working, you can use a service like Eyewitness.io. This is a dedicated Laravel application monitoring, that includes queue monitoring. If your queues stop working for any reason - you'll get notified. (Disclaimer: it is my site)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!