当我在节点js中使用bull库排队时得到错误,错误是这样的:
Error: read ECONNRESET at TCP.onStreamRead
- - errno: -104,
- - code: 'ECONNRESET',
- - syscall: 'read'
- - }
和
MaxRetriesPerRequestError: Reached the max retries per request limit (which is 20). Refer to "maxRetriesPerRequest" option for details.
这是我的代码:
const imageQueue = new Bull("imageQueue", process.env.REDIS_URL);
发布于 2021-08-31 03:52:02
已通过添加tls成功解决错误
const imageQueue = new Bull("imageQueue", process.env.REDIS_TLS_URL, {
redis: { tls: { rejectUnauthorized: false } },
});
发布于 2021-08-26 16:32:31
bull使用ioredis进行连接,并允许在队列构造函数中使用第三个opts参数。根据source code it looks for a redis property within those opts的说法。
您可以尝试对raise the retry limit to 100执行此操作。
const opts = {redis:{maxRetriesPerRequest:100}}
const imageQueue = new Bull("imageQueue", process.env.REDIS_URL, opts);
但是,你使用Heroku的redis服务的强度可能比他们允许的免费级别更高(如果你使用的话)。
https://stackoverflow.com/questions/68941211
复制相似问题