@@ -72,12 +72,6 @@ class Redis extends Commander {
72
72
private _autoPipelines = new Map ( ) ;
73
73
private _runningAutoPipelines = new Set ( ) ;
74
74
75
- // Prepare a cache of scripts and setup a interval which regularly clears it
76
- private _addedScriptHashes : { [ sha : string ] : true } = { } ;
77
- private _addedScriptHashesCleanInterval ?: ReturnType <
78
- typeof setInterval
79
- > | null = null ;
80
-
81
75
constructor ( port : number , host : string , options : RedisOptions ) ;
82
76
constructor ( path : string , options : RedisOptions ) ;
83
77
constructor ( port : number , options : RedisOptions ) ;
@@ -187,13 +181,6 @@ class Redis extends Commander {
187
181
process . nextTick ( this . emit . bind ( this , status , arg ) ) ;
188
182
}
189
183
190
- private clearAddedScriptHashesCleanInterval ( ) {
191
- if ( this . _addedScriptHashesCleanInterval ) {
192
- clearInterval ( this . _addedScriptHashesCleanInterval ) ;
193
- this . _addedScriptHashesCleanInterval = null ;
194
- }
195
- }
196
-
197
184
/**
198
185
* Create a connection to Redis.
199
186
* This method will be invoked automatically when creating a new Redis instance
@@ -213,18 +200,6 @@ class Redis extends Commander {
213
200
return ;
214
201
}
215
202
216
- // Make sure only one timer is active at a time
217
- this . clearAddedScriptHashesCleanInterval ( ) ;
218
-
219
- // Scripts need to get reset on reconnect as redis
220
- // might have been restarted or some failover happened
221
- this . _addedScriptHashes = { } ;
222
-
223
- // Start the script cache cleaning
224
- this . _addedScriptHashesCleanInterval = setInterval ( ( ) => {
225
- this . _addedScriptHashes = { } ;
226
- } , this . options . maxScriptsCachingTime ) ;
227
-
228
203
this . connectionEpoch += 1 ;
229
204
this . setStatus ( "connecting" ) ;
230
205
@@ -343,8 +318,6 @@ class Redis extends Commander {
343
318
* If you want to wait for the pending replies, use Redis#quit instead.
344
319
*/
345
320
disconnect ( reconnect = false ) {
346
- this . clearAddedScriptHashesCleanInterval ( ) ;
347
-
348
321
if ( ! reconnect ) {
349
322
this . manuallyClosing = true ;
350
323
}
@@ -626,10 +599,6 @@ class Redis extends Commander {
626
599
command . setTimeout ( this . options . commandTimeout ) ;
627
600
}
628
601
629
- if ( command . name === "quit" ) {
630
- this . clearAddedScriptHashesCleanInterval ( ) ;
631
- }
632
-
633
602
let writable =
634
603
this . status === "ready" ||
635
604
( ! stream &&
@@ -677,7 +646,16 @@ class Redis extends Commander {
677
646
command . args
678
647
) ;
679
648
}
680
- ( stream || this . stream ) . write ( command . toWritable ( ) ) ;
649
+
650
+ if ( stream ) {
651
+ if ( stream . isPipeline ) {
652
+ stream . write ( command . toWritable ( stream . destination . redis . stream ) ) ;
653
+ } else {
654
+ stream . write ( command . toWritable ( stream ) ) ;
655
+ }
656
+ } else {
657
+ this . stream . write ( command . toWritable ( this . stream ) ) ;
658
+ }
681
659
682
660
this . commandQueue . push ( {
683
661
command : command ,
0 commit comments