bull-arena 要求将队列构造函数提供给 Arena
bull-arena requires that the queue constructors be provided to Arena
使用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,
});
提前感谢您的帮助。
我今天遇到了这个问题。
解决方案如文档所述,您需要指定所支持的库。
在我看来它可能更清晰,但不知何故它是有道理的。您需要将 bull
导入为 Bull 并将其添加到配置中。
所以添加
const Bull = require('bull');
到文件顶部。
并将导入的 Bull,
添加到竞技场配置中。
const arenaConfig = Arena({
Bull,
queues: queuesConfig
}, {
basePath: "/",
disableListen: true,
});
类似这样的东西,它应该可以工作。我在我的代码中实现了它并且运行良好。
const Arena = require('bull-arena');
// Mandatory import of queue library.
const Bull = require('bull');
const queuesConfig = [];
for (const queue in queues) {
console.log(queue, queues[queue]);
queuesConfig.push({
name: queues[queue],
hostId: "worker",
redis: { url: redisHost }
});
}
const arenaConfig = Arena({
// All queue libraries used must be explicitly imported and included.
Bull,
queues: queuesConfig
}, {
basePath: "/",
disableListen: true,
});
我已经修复了这个 type-error
。公关 - #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
使用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,
});
提前感谢您的帮助。
我今天遇到了这个问题。
解决方案如文档所述,您需要指定所支持的库。
在我看来它可能更清晰,但不知何故它是有道理的。您需要将 bull
导入为 Bull 并将其添加到配置中。
所以添加
const Bull = require('bull');
到文件顶部。
并将导入的 Bull,
添加到竞技场配置中。
const arenaConfig = Arena({
Bull,
queues: queuesConfig
}, {
basePath: "/",
disableListen: true,
});
类似这样的东西,它应该可以工作。我在我的代码中实现了它并且运行良好。
const Arena = require('bull-arena');
// Mandatory import of queue library.
const Bull = require('bull');
const queuesConfig = [];
for (const queue in queues) {
console.log(queue, queues[queue]);
queuesConfig.push({
name: queues[queue],
hostId: "worker",
redis: { url: redisHost }
});
}
const arenaConfig = Arena({
// All queue libraries used must be explicitly imported and included.
Bull,
queues: queuesConfig
}, {
basePath: "/",
disableListen: true,
});
我已经修复了这个 type-error
。公关 - #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