Skip to content

Commit 2c695e1

Browse files
committed
fix(protocol): drop request when connection lost after writing to kernel buffer
1 parent 2dfcad0 commit 2c695e1

File tree

4 files changed

+16
-4
lines changed

4 files changed

+16
-4
lines changed

CHANGES.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changes Logs
22

3+
## v3.0.4
4+
5+
- fix(protocol): drop request when connection lost after writing to kernel buffer.
6+
37
## v3.0.3
48

59
- fix(command): Return keys in `HMGET` command correctly.

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@litert/redis",
3-
"version": "3.0.3",
3+
"version": "3.0.4",
44
"description": "A redis protocol implement for Node.js.",
55
"main": "./lib/index.js",
66
"scripts": {

src/lib/ProtocolClient.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -548,6 +548,8 @@ export class ProtocolClient
548548

549549
return this._unifyAsync(async (callback) => {
550550

551+
const execQueue = this._executingQueue;
552+
551553
this._checkQueueSize();
552554

553555
const data = this._encoder.encodeCommand(cmd, args);
@@ -559,7 +561,13 @@ export class ProtocolClient
559561

560562
await this._write2Socket(data);
561563

562-
this._executingQueue.push(handle);
564+
if (execQueue !== this._executingQueue) {
565+
566+
handle.callback(new E.E_CONN_LOST());
567+
return;
568+
}
569+
570+
execQueue.push(handle);
563571

564572
if (this._cfg.commandTimeout > 0) {
565573

0 commit comments

Comments
 (0)