You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Am I right in understanding that there is no way to disconnect a client while that client is blocking? I have a script where I keep an XREAD open indefinitely with BLOCK 0, but when it's time to exit my script I can't call quit() (it never completes) or disconnect() ("DisconnectsClientError").
Redis (the server) processes commands in order, so QUIT will wait for XREAD BLOCK to finish before processing the QUIT command.
Regarding disconnect - that should work, but it'll make the sendCommand promise throw DisconnectsClientError which you'll need to catch.
client.sendCommand([`XREAD`,`BLOCK`,`0`,`STREAMS`,`foo:bar`,`$`]).then(result=>{// this will be called if/when the command is process successfully}).catch(err=>{// this will be called if/when the command did not process successfully for any reason, including calling `disconnect` before the command is finished});awaitclient.disconnect();// will cause any running commands to throw/be rejected with `DisconnectsClientError`
Am I right in understanding that there is no way to disconnect a client while that client is blocking? I have a script where I keep an XREAD open indefinitely with BLOCK 0, but when it's time to exit my script I can't call quit() (it never completes) or disconnect() ("DisconnectsClientError").
The text was updated successfully, but these errors were encountered: