@ynhcj/xiaoyi-channel 1.1.23 → 1.1.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/provider.js +4 -4
- package/package.json +1 -1
package/dist/src/provider.js
CHANGED
|
@@ -158,14 +158,13 @@ function createRetryingStream(createStream, cronJob) {
|
|
|
158
158
|
}
|
|
159
159
|
if (event.type === "error") {
|
|
160
160
|
console.log(`[xiaoyiprovider] stream error after content: ${event.error?.errorMessage}`);
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
return;
|
|
161
|
+
errorResult = event.error;
|
|
162
|
+
break; // break inner loop, proceed to retry decision
|
|
164
163
|
}
|
|
165
164
|
yield event;
|
|
166
165
|
}
|
|
167
166
|
}
|
|
168
|
-
// Stream ended
|
|
167
|
+
// Stream ended (buffer or streaming phase) — decide whether to retry
|
|
169
168
|
if (errorResult?.stopReason === "error" && isRetryableProviderError(errorResult.errorMessage)) {
|
|
170
169
|
if (attempt < MAX_RETRY_ATTEMPTS - 1) {
|
|
171
170
|
const delayMs = getRetryDelayMs(attempt + 1, cronJob);
|
|
@@ -192,6 +191,7 @@ function createRetryingStream(createStream, cronJob) {
|
|
|
192
191
|
}
|
|
193
192
|
if (errorResult && buffer.every(b => b.type !== "done" && b.type !== "error")) {
|
|
194
193
|
resultResolve(errorResult);
|
|
194
|
+
yield { type: "error", reason: "error", error: errorResult };
|
|
195
195
|
}
|
|
196
196
|
return;
|
|
197
197
|
}
|