【问题标题】:BullMQ reusing redis connectionsBullMQ 重用 redis 连接
【发布时间】:2022-11-10 02:22:51
【问题描述】:

我正在尝试添加逻辑以使用 this section of the bullMQ docs 重新使用与 BullMQ 的 redis 连接。

我正在使用最新的 (1.80.6) BullMQ npm 版本。

从文档中,期望定义createClient 方法,这是QueueOptions 的属性。

但是,这样做会引发错误 TS2559。

类型 '{ createClient: (type: string, redisOpts: any); }' 没有 与“QueueOptions”类型相同的属性。

createClient 逻辑是否已弃用?如果是,是否有替代方案?

如果没有,任何指向做错了什么的指针?

【问题讨论】:

    标签: typescript ioredis bullmq


    【解决方案1】:

    您可以传递一个IORedis 实例作为连接。

    import IORedis from 'ioredis';
    const connection = new IORedis('redis://someredisurl:6379');
    const myQueue = new Queue('queue_name', { connection });
    

    【讨论】:

      猜你喜欢
      • 2020-07-20
      • 2021-12-14
      • 2022-06-16
      • 1970-01-01
      • 2021-06-27
      • 1970-01-01
      • 1970-01-01
      • 2013-08-09
      • 2012-08-15
      相关资源
      最近更新 更多