fixes broken AWS rate limit backoff

This commit is contained in:
nai-degen
2023-10-24 09:19:46 -05:00
parent 89e9b67f3f
commit 26dc79c8f1
9 changed files with 45 additions and 43 deletions
+1
View File
@@ -59,6 +59,7 @@ export const addKey: ProxyRequestMiddleware = (proxyReq, req) => {
}
}
keyPool.throttle(assignedKey);
req.key = assignedKey;
req.log.info(
{
@@ -4,7 +4,7 @@ import { promisify } from "util";
import {
buildFakeSse,
copySseResponseHeaders,
initializeSseStream
initializeSseStream,
} from "../../../shared/streaming";
import { enqueue } from "../../queue";
import { decodeResponseBody, RawResponseBodyHandler, RetryableError } from ".";
@@ -83,7 +83,7 @@ export const handleStreamedResponse: RawResponseBodyHandler = async (
return aggregator.getFinalResponse();
} catch (err) {
if (err instanceof RetryableError) {
keyPool.markRateLimited(req.key!)
keyPool.markRateLimited(req.key!);
req.log.warn(
{ key: req.key!.hash, retryCount: req.retryCount },
`Re-enqueueing request due to retryable error during streaming response.`