Skip to content

Commit 284fd25

Browse files
committed
If the rate limit error is thrown, don’t retry the API request
1 parent 970ff0c commit 284fd25

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

packages/trigger-sdk/src/apiClient.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -904,7 +904,7 @@ async function zodfetchWithVersions<
904904
body: versionedSchema.parse(jsonBody),
905905
};
906906
} catch (error) {
907-
if (error instanceof UnknownVersionError) {
907+
if (error instanceof UnknownVersionError || error instanceof AutoYieldRateLimitError) {
908908
throw error;
909909
}
910910

@@ -1031,6 +1031,10 @@ async function zodfetch<TResponseSchema extends z.ZodTypeAny, TOptional extends
10311031

10321032
return schema.parse(jsonBody);
10331033
} catch (error) {
1034+
if (error instanceof AutoYieldRateLimitError) {
1035+
throw error;
1036+
}
1037+
10341038
if (retryCount < MAX_RETRIES) {
10351039
// retry with exponential backoff and jitter
10361040
const delay = exponentialBackoff(retryCount + 1);

0 commit comments

Comments
 (0)