Reputation: 443
i got error when i queue with bull library in node js, the error is like this :
Error: read ECONNRESET at TCP.onStreamRead
- - errno: -104,
- - code: 'ECONNRESET',
- - syscall: 'read'
- - }
and
MaxRetriesPerRequestError: Reached the max retries per request limit (which is 20). Refer to "maxRetriesPerRequest" option for details.
this my code :
const imageQueue = new Bull("imageQueue", process.env.REDIS_URL);
Upvotes: 1
Views: 6756
Reputation: 121
You can do something similar as what is suggested on the npm package docs.
// This is the default value of `retryStrategy`
retryStrategy(times) {
const delay = Math.min(times * 50, 2000);
return delay;
},
});
https://www.npmjs.com/package/ioredis#user-content-auto-reconnect
You'd need to send this redis configuration when creating the bull queue.
Upvotes: 0
Reputation: 443
error solved successfully by adding tls
const imageQueue = new Bull("imageQueue", process.env.REDIS_TLS_URL, {
redis: { tls: { rejectUnauthorized: false } },
});
Upvotes: 7
Reputation: 108796
bull uses ioredis to connect, and allows a third opts parameter in the Queue constructor. According to the source code it looks for a redis property within those opts.
You might try this to raise the retry limit to 100.
const opts = {redis:{maxRetriesPerRequest:100}}
const imageQueue = new Bull("imageQueue", process.env.REDIS_URL, opts);
But, also, you may be using Heroku's redis service more intensively than they allow for the free tier (if that's what you use).
Upvotes: 0