@@ -35,7 +35,7 @@ export class RedisSentinelClient<
35
35
36
36
/**
37
37
* Indicates if the client connection is open
38
- *
38
+ *
39
39
* @returns `true` if the client connection is open, `false` otherwise
40
40
*/
41
41
@@ -45,7 +45,7 @@ export class RedisSentinelClient<
45
45
46
46
/**
47
47
* Indicates if the client connection is ready to accept commands
48
- *
48
+ *
49
49
* @returns `true` if the client connection is ready, `false` otherwise
50
50
*/
51
51
get isReady ( ) {
@@ -54,7 +54,7 @@ export class RedisSentinelClient<
54
54
55
55
/**
56
56
* Gets the command options configured for this client
57
- *
57
+ *
58
58
* @returns The command options for this client or `undefined` if none were set
59
59
*/
60
60
get commandOptions ( ) {
@@ -241,10 +241,10 @@ export class RedisSentinelClient<
241
241
242
242
/**
243
243
* Releases the client lease back to the pool
244
- *
244
+ *
245
245
* After calling this method, the client instance should no longer be used as it
246
246
* will be returned to the client pool and may be given to other operations.
247
- *
247
+ *
248
248
* @returns A promise that resolves when the client is ready to be reused, or undefined
249
249
* if the client was immediately ready
250
250
* @throws Error if the lease has already been released
@@ -274,7 +274,7 @@ export default class RedisSentinel<
274
274
275
275
/**
276
276
* Indicates if the sentinel connection is open
277
- *
277
+ *
278
278
* @returns `true` if the sentinel connection is open, `false` otherwise
279
279
*/
280
280
get isOpen ( ) {
@@ -283,7 +283,7 @@ export default class RedisSentinel<
283
283
284
284
/**
285
285
* Indicates if the sentinel connection is ready to accept commands
286
- *
286
+ *
287
287
* @returns `true` if the sentinel connection is ready, `false` otherwise
288
288
*/
289
289
get isReady ( ) {
@@ -554,15 +554,15 @@ export default class RedisSentinel<
554
554
555
555
/**
556
556
* Acquires a master client lease for exclusive operations
557
- *
557
+ *
558
558
* Used when multiple commands need to run on an exclusive client (for example, using `WATCH/MULTI/EXEC`).
559
559
* The returned client must be released after use with the `release()` method.
560
- *
560
+ *
561
561
* @returns A promise that resolves to a Redis client connected to the master node
562
562
* @example
563
563
* ```javascript
564
564
* const clientLease = await sentinel.acquire();
565
- *
565
+ *
566
566
* try {
567
567
* await clientLease.watch('key');
568
568
* const resp = await clientLease.multi()
@@ -670,7 +670,7 @@ class RedisSentinelInternal<
670
670
super ( ) ;
671
671
672
672
this . #validateOptions( options ) ;
673
-
673
+
674
674
this . #name = options . name ;
675
675
676
676
this . #sentinelRootNodes = Array . from ( options . sentinelRootNodes ) ;
@@ -728,7 +728,7 @@ class RedisSentinelInternal<
728
728
729
729
/**
730
730
* Gets a client lease from the master client pool
731
- *
731
+ *
732
732
* @returns A client info object or a promise that resolves to a client info object
733
733
* when a client becomes available
734
734
*/
@@ -743,10 +743,10 @@ class RedisSentinelInternal<
743
743
744
744
/**
745
745
* Releases a client lease back to the pool
746
- *
746
+ *
747
747
* If the client was used for a transaction that might have left it in a dirty state,
748
748
* it will be reset before being returned to the pool.
749
- *
749
+ *
750
750
* @param clientInfo The client info object representing the client to release
751
751
* @returns A promise that resolves when the client is ready to be reused, or undefined
752
752
* if the client was immediately ready or no longer exists
@@ -786,10 +786,10 @@ class RedisSentinelInternal<
786
786
787
787
async #connect( ) {
788
788
let count = 0 ;
789
- while ( true ) {
789
+ while ( true ) {
790
790
this . #trace( "starting connect loop" ) ;
791
791
792
- count += 1 ;
792
+ count += 1 ;
793
793
if ( this . #destroy) {
794
794
this . #trace( "in #connect and want to destroy" )
795
795
return ;
@@ -842,7 +842,7 @@ class RedisSentinelInternal<
842
842
843
843
try {
844
844
/*
845
- // force testing of READONLY errors
845
+ // force testing of READONLY errors
846
846
if (clientInfo !== undefined) {
847
847
if (Math.floor(Math.random() * 10) < 1) {
848
848
console.log("throwing READONLY error");
@@ -856,7 +856,7 @@ class RedisSentinelInternal<
856
856
throw err ;
857
857
}
858
858
859
- /*
859
+ /*
860
860
rediscover and retry if doing a command against a "master"
861
861
a) READONLY error (topology has changed) but we haven't been notified yet via pubsub
862
862
b) client is "not ready" (disconnected), which means topology might have changed, but sentinel might not see it yet
@@ -1569,4 +1569,4 @@ export class RedisSentinelFactory extends EventEmitter {
1569
1569
}
1570
1570
} ) ;
1571
1571
}
1572
- }
1572
+ }
0 commit comments