Closed MadeinFrance closed 4 years ago
@MadeinFrance Thanks for reporting this potential bug.
Could you tell me what version of the redis module you are using?
It seems like this may be an issue with the redis module when it fails to retry. See here: https://github.com/NodeRedis/node_redis/issues/1418
My very naive guess is that redis is returning a large number of results and that is taking some time to parse, and so it is dropping the connection/retrying/failing to retry.
It seems like the issue may not present itself when using ioredis. Would you like to give that a try?
Redis server v=5.0.3 sha=00000000:0 malloc=libc bits=64 build=5ac74f5d434534dd
I can give a try with ioredis.
So node-georedis
is compatible with ioredis
?
var Redis = require("ioredis");
var redisClient = new Redis();
const geo = require('georedis').initialize(redisClient);
@MadeinFrance Yes that would be exactly how to use ioredis, that should work the same as with the standard redis package.
As for the version of redis, I meant which version of the redis npm package.
"redis": "2.8.0"
"georedis": "3.1.1",
I will update this issue with my results of ioredis
@MadeinFrance Okay thank you. Please keep me posted.
Can you tell me, when performing your original query at 10km, is there a delay before the error occurs? How many results of the 250,000 are expected at 10km? How many at 5km?
You mention that the issue happens less at a smaller radius, but it still happens?
Loading 10km returns ~60 results which is handled well.
Thanks for pointing at it, using ioredis
fixed the timeouts issues.
Closing the issue since is not related to this well made library.
@MadeinFrance Okay thank you for letting me know. If you want to continue using the redis module, you may want to look into the retry_strategy
option, or also the socket_keepalive
option. I'm not sure at all if it will solve your problem, but it seems like a probably place to look:
const client = redis.createClient({
socket_keepalive: true,
retry_strategy: (options) => {
if (options.error && options.error.code === 'ECONNREFUSED') {
return new Error('The server refused the connection');
}
if (options.total_retry_time > 1000 * 60 * 60) {
return new Error('Retry time exhausted');
}
if (options.attempt > 10) {
return undefined;
}
// reconnect after
return 1000;
}
});
I retrieve locations with the
nearby
method. However I see the following errors:There's 250K locations saved.
Other simple redis commands works. Should I consider using another way of storing locations? Any ideas of the cause?
By reducing the radius to 5km it seems to happen less.