@midwayjs/redis 3.3.5 → 3.4.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/manager.js +14 -9
- package/package.json +5 -5
package/dist/manager.js
CHANGED
|
@@ -23,9 +23,7 @@ let RedisServiceFactory = class RedisServiceFactory extends core_1.ServiceFactor
|
|
|
23
23
|
if (config.cluster === true) {
|
|
24
24
|
assert(config.nodes && config.nodes.length !== 0, '[midway:redis] cluster nodes configuration is required when use cluster redis');
|
|
25
25
|
config.nodes.forEach(client => {
|
|
26
|
-
assert(client.host &&
|
|
27
|
-
client.port &&
|
|
28
|
-
`[midway:redis] 'host: ${client.host}', 'port: ${client.port}' are required on config`);
|
|
26
|
+
assert(client.host && client.port, `[midway:redis] 'host: ${client.host}', 'port: ${client.port}' are required on config`);
|
|
29
27
|
});
|
|
30
28
|
this.logger.info('[midway:redis] cluster connecting');
|
|
31
29
|
client = new ioredis_1.default.Cluster(config.nodes, config);
|
|
@@ -43,12 +41,15 @@ let RedisServiceFactory = class RedisServiceFactory extends core_1.ServiceFactor
|
|
|
43
41
|
this.logger.info('[midway:redis] server connecting redis://:***@%s:%s/%s', config.host, config.port);
|
|
44
42
|
client = new ioredis_1.default(config);
|
|
45
43
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
44
|
+
await new Promise((resolve, reject) => {
|
|
45
|
+
client.on('connect', () => {
|
|
46
|
+
this.logger.info('[midway:redis] client connect success');
|
|
47
|
+
resolve();
|
|
48
|
+
});
|
|
49
|
+
client.on('error', err => {
|
|
50
|
+
this.logger.error('[midway:redis] client error: %s', err);
|
|
51
|
+
reject(err);
|
|
52
|
+
});
|
|
52
53
|
});
|
|
53
54
|
return client;
|
|
54
55
|
}
|
|
@@ -104,4 +105,8 @@ RedisService = __decorate([
|
|
|
104
105
|
], RedisService);
|
|
105
106
|
exports.RedisService = RedisService;
|
|
106
107
|
(0, core_1.delegateTargetAllPrototypeMethod)(RedisService, ioredis_1.default);
|
|
108
|
+
RedisService.prototype.defineCommand = function (name, definition) {
|
|
109
|
+
this.instance.defineCommand(name, definition);
|
|
110
|
+
(0, core_1.delegateTargetMethod)(RedisService, [name]);
|
|
111
|
+
};
|
|
107
112
|
//# sourceMappingURL=manager.js.map
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midwayjs/redis",
|
|
3
3
|
"description": "midway redis component",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.4.0-beta.10",
|
|
5
5
|
"main": "dist/index",
|
|
6
6
|
"typings": "index.d.ts",
|
|
7
7
|
"files": [
|
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
"index.d.ts"
|
|
11
11
|
],
|
|
12
12
|
"devDependencies": {
|
|
13
|
-
"@midwayjs/core": "^3.
|
|
14
|
-
"@midwayjs/decorator": "^3.
|
|
15
|
-
"@midwayjs/mock": "^3.
|
|
13
|
+
"@midwayjs/core": "^3.4.0-beta.10",
|
|
14
|
+
"@midwayjs/decorator": "^3.4.0-beta.10",
|
|
15
|
+
"@midwayjs/mock": "^3.4.0-beta.10"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"ioredis": "^5.0.0"
|
|
@@ -36,5 +36,5 @@
|
|
|
36
36
|
"type": "git",
|
|
37
37
|
"url": "https://github.com/midwayjs/midway.git"
|
|
38
38
|
},
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "560a5fa311605e4008c55f31c31bc4e12eeff2a5"
|
|
40
40
|
}
|