File tree Expand file tree Collapse file tree 1 file changed +11
-6
lines changed
Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -112,8 +112,13 @@ export class RedisClient {
112112 } ) ( ) ;
113113
114114 // Listen for socket close events and parse responses.
115- this . #connection
116- . then ( async ( connection ) => {
115+ this . #connection. then ( async ( connection ) => {
116+ let closed = false ;
117+ connection . socket . closed . then ( ( ) => {
118+ closed = true ;
119+ } ) ;
120+
121+ try {
117122 while ( true ) {
118123 const result = await connection . reader . read ( ) ;
119124 if ( ! result ) {
@@ -126,12 +131,12 @@ export class RedisClient {
126131 break ;
127132 }
128133 }
129- } )
130- . catch ( ( error ) => {
131- if ( error ) {
134+ } catch ( error ) {
135+ if ( ! closed && this . #connection) {
132136 console . error ( error ) ;
133137 }
134- } ) ;
138+ }
139+ } ) ;
135140
136141 if ( this . config . password || this . config . database ) {
137142 // AUTH and SELECT block all other commands until they are resolved.
You can’t perform that action at this time.
0 commit comments