You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-07 13:22:56 +03:00
@@ -203,9 +203,9 @@ export default class RESP2Decoder {
|
|||||||
this.arrayItemType = undefined;
|
this.arrayItemType = undefined;
|
||||||
|
|
||||||
if (length === -1) {
|
if (length === -1) {
|
||||||
return this.returnArrayReply(null, arraysToKeep);
|
return this.returnArrayReply(null, arraysToKeep, chunk);
|
||||||
} else if (length === 0) {
|
} else if (length === 0) {
|
||||||
return this.returnArrayReply([], arraysToKeep);
|
return this.returnArrayReply([], arraysToKeep, chunk);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.arraysInProcess.push({
|
this.arraysInProcess.push({
|
||||||
@@ -235,20 +235,23 @@ export default class RESP2Decoder {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private returnArrayReply(reply: ArrayReply, arraysToKeep: number): ArrayReply | undefined {
|
private returnArrayReply(reply: ArrayReply, arraysToKeep: number, chunk?: Buffer): ArrayReply | undefined {
|
||||||
if (this.arraysInProcess.length <= arraysToKeep) return reply;
|
if (this.arraysInProcess.length <= arraysToKeep) return reply;
|
||||||
|
|
||||||
return this.pushArrayItem(reply, arraysToKeep);
|
return this.pushArrayItem(reply, arraysToKeep, chunk);
|
||||||
}
|
}
|
||||||
|
|
||||||
private pushArrayItem(item: Reply, arraysToKeep: number): ArrayReply | undefined {
|
private pushArrayItem(item: Reply, arraysToKeep: number, chunk?: Buffer): ArrayReply | undefined {
|
||||||
const to = this.arraysInProcess[this.arraysInProcess.length - 1]!;
|
const to = this.arraysInProcess[this.arraysInProcess.length - 1]!;
|
||||||
to.array[to.pushCounter] = item;
|
to.array[to.pushCounter] = item;
|
||||||
if (++to.pushCounter === to.array.length) {
|
if (++to.pushCounter === to.array.length) {
|
||||||
return this.returnArrayReply(
|
return this.returnArrayReply(
|
||||||
this.arraysInProcess.pop()!.array,
|
this.arraysInProcess.pop()!.array,
|
||||||
arraysToKeep
|
arraysToKeep,
|
||||||
|
chunk
|
||||||
);
|
);
|
||||||
|
} else if (chunk && chunk.length > this.cursor) {
|
||||||
|
return this.parseArray(chunk, arraysToKeep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user