MCPcopy
hub / github.com/redis/ioredis / abortIncompletePipelines

Function abortIncompletePipelines

lib/redis/event_handler.ts:159–174  ·  view source on GitHub ↗
(commandQueue: Deque<CommandItem>)

Source from the content-addressed store, hash-verified

157// example, if the queue looks like this: [2, 3, 4, 0, 1, 2] then after
158// aborting and purging we'll have a queue that looks like this: [0, 1, 2]
159function abortIncompletePipelines(commandQueue: Deque<CommandItem>) {
160 let expectedIndex = 0;
161 for (let i = 0; i < commandQueue.length; ) {
162 const command = commandQueue.peekAt(i)?.command as Command;
163 const pipelineIndex = command.pipelineIndex;
164 if (pipelineIndex === undefined || pipelineIndex === 0) {
165 expectedIndex = 0;
166 }
167 if (pipelineIndex !== undefined && pipelineIndex !== expectedIndex++) {
168 commandQueue.remove(i, 1);
169 command.reject(abortError(command));
170 continue;
171 }
172 i++;
173 }
174}
175
176// If only a partial transaction result was received before connection close,
177// we have to abort any transaction fragments that may have ended up in the

Callers 1

closeHandlerFunction · 0.85

Calls 2

abortErrorFunction · 0.85
rejectMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…