gpt4 book ai didi

node.js - bull-arena 要求将队列构造函数提供给 Arena

转载 作者:行者123 更新时间:2023-12-02 19:16:34 27 4
gpt4 key购买 nike

使用 bull-arena: "^3.2.2"版本。在启动竞技场仪表板时遇到此错误

TypeError: as of 3.0.0, bull-arena requires that the queue constructors be provided to Arena

我尝试使用队列实例而不是队列名称作为参数,但没有成功。

源代码:

import Arena from "bull-arena";
import Bull from "bull";

const queuesConfig = [];
for (const queue in queues) {
queuesConfig.push({
name: queues[queue],
hostId: "worker",
redis: { url: redisHost }
});
}

const arenaConfig = Arena({
queues: queuesConfig
}, {
basePath: "/",
disableListen: true,
});

提前感谢您的帮助。

最佳答案

我已经修复了这个类型错误。公共(public)关系 - #48242
他们在 bull-arena 中添加了必需的构造函数条件,但没有更新 @types/bull-arena。所以,我们面临着这个问题。
我们必须提供 Bull 或 Bee 构造函数来运行代码。现在,它也可以与 import 一起使用。

import Arena from "bull-arena";
import Bull from "bull";
import Bee from "bee-queue";

公牛

const arenaConfig = Arena({
Bull,
queues: queuesConfig
}, {
basePath: "/",
disableListen: true,
});

蜜蜂

const arenaConfig = Arena({
Bee,
queues: queuesConfig
}, {
basePath: "/",
disableListen: true,
});

如果你不提供任何队列构造函数,那么它会抛出这个错误。

TypeError: as of 3.0.0, bull-arena requires that the queue constructors be provided to Arena

关于node.js - bull-arena 要求将队列构造函数提供给 Arena,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63624035/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com