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

Method fillResult

lib/Pipeline.ts:78–208  ·  view source on GitHub ↗
(value: unknown[], position: number)

Source from the content-addressed store, hash-verified

76 }
77
78 fillResult(value: unknown[], position: number) {
79 if (this._queue[position].name === "exec" && Array.isArray(value[1])) {
80 const execLength = value[1].length;
81 for (let i = 0; i < execLength; i++) {
82 if (value[1][i] instanceof Error) {
83 continue;
84 }
85 const cmd = this._queue[position - (execLength - i)];
86 try {
87 value[1][i] = cmd.transformReply(value[1][i]);
88 } catch (err) {
89 value[1][i] = err;
90 }
91 }
92 }
93 this._result[position] = value;
94
95 if (--this.replyPending) {
96 return;
97 }
98
99 if (this.isCluster) {
100 let retriable = true;
101 let commonError: { name: string; message: string };
102 for (let i = 0; i < this._result.length; ++i) {
103 const error = this._result[i][0];
104 const command = this._queue[i];
105 if (error) {
106 if (
107 command.name === "exec" &&
108 error.message ===
109 "EXECABORT Transaction discarded because of previous errors."
110 ) {
111 continue;
112 }
113 if (!commonError) {
114 commonError = {
115 name: error.name,
116 message: error.message,
117 };
118 } else if (
119 commonError.name !== error.name ||
120 commonError.message !== error.message
121 ) {
122 retriable = false;
123 break;
124 }
125 } else if (!command.inTransaction) {
126 const isReadOnly =
127 exists(command.name, { caseInsensitive: true }) &&
128 hasFlag(command.name, "readonly", { nameCaseInsensitive: true });
129 if (!isReadOnly) {
130 retriable = false;
131 break;
132 }
133 }
134 }
135 if (commonError && retriable) {

Callers 1

sendCommandMethod · 0.95

Calls 7

sendCommandMethod · 0.95
transformReplyMethod · 0.80
initPromiseMethod · 0.80
handleErrorMethod · 0.80
refreshSlotsCacheMethod · 0.80
execMethod · 0.65
resolveMethod · 0.65

Tested by

no test coverage detected