Horizon 检测不到队列任务和错误

启动Horizon后,可以看到dashboard并且在terminal可以看到Horizon started successfully.
此时还没有进行到 “6. 代码调整” 这一步,也就是说序列化的问题依然存在,可是无论是创建/更新话题,什么也检测不到。请大神们指教。谢谢。

class TopicObserver
{
public function saving(Topic $topic)
{
$topic->body = clean($topic->body, 'user_topic_body');
$topic->excerpt = make_excerpt($topic->body);
// 此处做了小修改,判断title是否未空,如果用slug,无法进行更新
if (!$topic->title) {
// push the 'JOB' into the 'QUEUE'
dispatch(new TranslateSlug($topic));
}
}
}

class TranslateSlug implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

protected $topic;

public function __construct(Topic $topic)
{
    $this->topic = $topic;
}

public function handle()
{
    //无法注册百度API,所以此处没有采用教程的方法,进行了简化,对$topic->title进行简单处理然后写入slug
    //个人觉得,即使不使用百度API,也不应该影响队列的使用
    $slug = connect_string_with_dash($this->topic->title);
    \DB::table('topics')->where('id', $this->topic->id)->update(['slug' => $slug]);
}

}

//这个方法写在全局helpers.php里面,简单的字符串处理
function connect_string_with_dash($input){
if (!isset($input) && empty($input)) {
return false;
}
$tmp_output = explode(' ', preg_replace('/\s+/', ' ', trim($input)));
$output = implode('-', $tmp_output);
return $output;
}

《L03 构架 API 服务器》
你将学到如 RESTFul 设计风格、PostMan 的使用、OAuth 流程,JWT 概念及使用 和 API 开发相关的进阶知识。
《L02 从零构建论坛系统》
以构建论坛项目 LaraBBS 为线索,展开对 Laravel 框架的全面学习。应用程序架构思路贴近 Laravel 框架的设计哲学。
讨论数量: 8

看看是否开启 php artisan queue:listen

5年前 评论

@sunnylin
我使用的是 “php artisan horizon”,教程里有这么一段话,“安装了 Horizon 以后,我们将使用 horizon 命令来启动队列系统和任务监控,无需使用 queue:listen”
file

运行命令“php artisan queue:listen” 也监测不到。
file

5年前 评论

那你创建一个帖子试一试

5年前 评论

@sunnylin 创建和更新都试验了,不行

file

5年前 评论

那记录错误的表有没有记录

5年前 评论

@sunnylin 这个是log,麻烦帮忙看下,谢谢。

file

有个情况,在运行命令 “php artisan queue:listen” 之后,就会报错
file

5年前 评论

把这一块重新做一遍

5年前 评论

我遇到同样的问题,楼主解决了吗

4年前 评论

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!