@xnestjs/ioredis 1.6.2 → 1.6.4

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.
@@ -38,6 +38,8 @@ function getRedisConfig(options, prefix = 'REDIS_') {
38
38
  redisOptions.noDelay = redisOptions.noDelay ?? (0, putil_varhelpers_1.toBoolean)(env[prefix + 'NO_DELAY']);
39
39
  redisOptions.connectionName = redisOptions.connectionName ?? env[prefix + 'CONNECTION_NAME'];
40
40
  redisOptions.maxRetriesPerRequest =
41
- redisOptions.maxRetriesPerRequest ?? (0, putil_varhelpers_1.toInt)(env[prefix + 'MAX_RETRIES_PER_REQUEST']);
41
+ redisOptions.maxRetriesPerRequest === null
42
+ ? null
43
+ : (redisOptions.maxRetriesPerRequest ?? (0, putil_varhelpers_1.toInt)(env[prefix + 'MAX_RETRIES_PER_REQUEST']));
42
44
  return out;
43
45
  }
@@ -124,25 +124,25 @@ let RedisCoreModule = RedisCoreModule_1 = class RedisCoreModule {
124
124
  }
125
125
  async onApplicationBootstrap() {
126
126
  const opts = this.connectionOptions;
127
- if (!opts.lazyConnect) {
128
- const isCluster = (0, utils_js_1.isClusterOptions)(opts);
129
- const hosts = isCluster
130
- ? opts.nodes
131
- .map(x => (typeof x === 'object' ? x.host + ':' + x.port : typeof x === 'number' ? 'localhost:' + x : x))
132
- .join(', ')
133
- : opts.host;
134
- if (hosts) {
135
- this.logger?.log('Connecting to redis at ' + ansi_colors_1.default.blue(hosts));
136
- common_1.Logger.flush();
137
- try {
138
- if (this.client.redis.status === 'wait')
139
- await this.client.redis.connect();
140
- await this.client.redis.ping();
141
- }
142
- catch (e) {
143
- this.logger?.error('Redis connection failed: ' + e.message);
144
- throw e;
145
- }
127
+ if (opts.lazyConnect)
128
+ return;
129
+ const isCluster = (0, utils_js_1.isClusterOptions)(opts);
130
+ const hosts = isCluster
131
+ ? opts.nodes
132
+ .map(x => (typeof x === 'object' ? x.host + ':' + x.port : typeof x === 'number' ? 'localhost:' + x : x))
133
+ .join(', ')
134
+ : opts.host;
135
+ if (hosts) {
136
+ this.logger?.log('Connecting to redis at ' + ansi_colors_1.default.blue(hosts));
137
+ common_1.Logger.flush();
138
+ try {
139
+ if (this.client.redis.status === 'wait')
140
+ await this.client.redis.connect();
141
+ await this.client.redis.ping();
142
+ }
143
+ catch (e) {
144
+ this.logger?.error('Redis connection failed: ' + e.message);
145
+ throw e;
146
146
  }
147
147
  }
148
148
  }
@@ -34,6 +34,8 @@ export function getRedisConfig(options, prefix = 'REDIS_') {
34
34
  redisOptions.noDelay = redisOptions.noDelay ?? toBoolean(env[prefix + 'NO_DELAY']);
35
35
  redisOptions.connectionName = redisOptions.connectionName ?? env[prefix + 'CONNECTION_NAME'];
36
36
  redisOptions.maxRetriesPerRequest =
37
- redisOptions.maxRetriesPerRequest ?? toInt(env[prefix + 'MAX_RETRIES_PER_REQUEST']);
37
+ redisOptions.maxRetriesPerRequest === null
38
+ ? null
39
+ : (redisOptions.maxRetriesPerRequest ?? toInt(env[prefix + 'MAX_RETRIES_PER_REQUEST']));
38
40
  return out;
39
41
  }
@@ -121,25 +121,25 @@ let RedisCoreModule = RedisCoreModule_1 = class RedisCoreModule {
121
121
  }
122
122
  async onApplicationBootstrap() {
123
123
  const opts = this.connectionOptions;
124
- if (!opts.lazyConnect) {
125
- const isCluster = isClusterOptions(opts);
126
- const hosts = isCluster
127
- ? opts.nodes
128
- .map(x => (typeof x === 'object' ? x.host + ':' + x.port : typeof x === 'number' ? 'localhost:' + x : x))
129
- .join(', ')
130
- : opts.host;
131
- if (hosts) {
132
- this.logger?.log('Connecting to redis at ' + colors.blue(hosts));
133
- Logger.flush();
134
- try {
135
- if (this.client.redis.status === 'wait')
136
- await this.client.redis.connect();
137
- await this.client.redis.ping();
138
- }
139
- catch (e) {
140
- this.logger?.error('Redis connection failed: ' + e.message);
141
- throw e;
142
- }
124
+ if (opts.lazyConnect)
125
+ return;
126
+ const isCluster = isClusterOptions(opts);
127
+ const hosts = isCluster
128
+ ? opts.nodes
129
+ .map(x => (typeof x === 'object' ? x.host + ':' + x.port : typeof x === 'number' ? 'localhost:' + x : x))
130
+ .join(', ')
131
+ : opts.host;
132
+ if (hosts) {
133
+ this.logger?.log('Connecting to redis at ' + colors.blue(hosts));
134
+ Logger.flush();
135
+ try {
136
+ if (this.client.redis.status === 'wait')
137
+ await this.client.redis.connect();
138
+ await this.client.redis.ping();
139
+ }
140
+ catch (e) {
141
+ this.logger?.error('Redis connection failed: ' + e.message);
142
+ throw e;
143
143
  }
144
144
  }
145
145
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xnestjs/ioredis",
3
- "version": "1.6.2",
3
+ "version": "1.6.4",
4
4
  "description": "NestJS extension library for ioredis",
5
5
  "author": "Panates",
6
6
  "license": "MIT",