Comparing version
@@ -5,2 +5,9 @@ # Changelog | ||
### [0.3.6](https://github.com/escaletech/tog-node/compare/v0.3.5...v0.3.6) (2020-03-03) | ||
### Bug Fixes | ||
* consider all redis nodes when listing flags ([9f6dd84](https://github.com/escaletech/tog-node/commit/9f6dd8452156edbe243f90499c3dd261739933ca)) | ||
### [0.3.5](https://github.com/escaletech/tog-node/compare/v0.3.4...v0.3.5) (2020-03-03) | ||
@@ -7,0 +14,0 @@ |
import { Flag, ClientOptions } from "./types"; | ||
import { Redis } from './redis'; | ||
import { Redis, Cluster } from 'ioredis'; | ||
/** | ||
@@ -13,3 +13,3 @@ * A client for managing flags | ||
export declare class FlagClient { | ||
readonly redis: Redis; | ||
readonly redis: Redis | Cluster; | ||
/** | ||
@@ -16,0 +16,0 @@ * @param redisUrl The Redis connection string |
@@ -78,11 +78,24 @@ "use strict"; | ||
return __awaiter(this, void 0, void 0, function () { | ||
var keys; | ||
var keys, _a; | ||
var _this = this; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, this.redis.keys(keys_1.flagKey(namespace, '*'))]; | ||
return __generator(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: | ||
if (!('nodes' in this.redis)) return [3 /*break*/, 2]; | ||
return [4 /*yield*/, Promise.all(this.redis.nodes('all').map(function (n) { return n.keys(keys_1.flagKey(namespace, '*')); })) | ||
.then(function (keys) { | ||
var _a; | ||
return Array.from(new Set((_a = []).concat.apply(_a, keys))); | ||
})]; | ||
case 1: | ||
keys = _a.sent(); | ||
_a = _b.sent(); | ||
return [3 /*break*/, 4]; | ||
case 2: return [4 /*yield*/, this.redis.keys(keys_1.flagKey(namespace, '*'))]; | ||
case 3: | ||
_a = _b.sent(); | ||
_b.label = 4; | ||
case 4: | ||
keys = _a; | ||
return [4 /*yield*/, Promise.all(keys.sort().map(function (key) { return _this.getFlagByKey(key); }))]; | ||
case 2: return [2 /*return*/, _a.sent()]; | ||
case 5: return [2 /*return*/, _b.sent()]; | ||
} | ||
@@ -89,0 +102,0 @@ }); |
import { Session, SessionOptions, ClientOptions } from "./types"; | ||
import { Redis } from './redis'; | ||
import { Redis, Cluster } from 'ioredis'; | ||
/** | ||
@@ -14,3 +14,3 @@ * A client consuming sessions | ||
private readonly flags; | ||
readonly redis: Redis; | ||
readonly redis: Redis | Cluster; | ||
/** | ||
@@ -17,0 +17,0 @@ * @param redisUrl The Redis connection string |
{ | ||
"name": "tog-node", | ||
"version": "0.3.5", | ||
"version": "0.3.6", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
Sorry, the diff of this file is not supported yet
33061
2.59%533
0.57%22
-12%