You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-06 02:15:48 +03:00
Add a better promise documentation and add some tests
This commit is contained in:
@@ -15,18 +15,15 @@ function waitForRedis (available, cb) {
|
||||
|
||||
var ipV4 = false;
|
||||
var id = setInterval(function () {
|
||||
tcpPortUsed.check(config.PORT, '127.0.0.1')
|
||||
.then(function (_ipV4) {
|
||||
ipV4 = _ipV4;
|
||||
return tcpPortUsed.check(config.PORT, '::1');
|
||||
})
|
||||
.then(function (ipV6) {
|
||||
if (ipV6 === available && ipV4 === available &&
|
||||
fs.existsSync('/tmp/redis.sock') === available) {
|
||||
clearInterval(id);
|
||||
return cb();
|
||||
}
|
||||
});
|
||||
tcpPortUsed.check(config.PORT, '127.0.0.1').then(function (_ipV4) {
|
||||
ipV4 = _ipV4;
|
||||
return tcpPortUsed.check(config.PORT, '::1');
|
||||
}).then(function (ipV6) {
|
||||
if (ipV6 === available && ipV4 === available && fs.existsSync('/tmp/redis.sock') === available) {
|
||||
clearInterval(id);
|
||||
return cb();
|
||||
}
|
||||
});
|
||||
}, 100);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user