Skip to content
Source
Sign inSign up
TanStack/schemas

Retry each Azure retail price page on 429 #692

Mergedtombeckenhammerged 1 commit intomain from691-azure-retail-price-list-retry-429-on-each-pagemerged by tombeckenham View on GitHub

Showing 3 changed files with 88 additions and 31 deletions.

x
0 of 3 viewed, 3 left
72 additions and 24 deletionssrc/server/providers/adapters/azure.test.tsModified
View file
@@ -1,4 +1,4 @@
-import { afterEach, describe, expect, it } from 'vitest'
+import { afterEach, describe, expect, it, vi } from 'vitest'
​
import { AZURE_MODELS_URL, AZURE_REASONING_URL } from '../azure-models.ts'
import { AZURE_PRICES_URL, AZURE_PRICING_PAGE_URL } from '../azure-pricing.ts'
@@ -96,8 +96,12 @@
urls: Array<string> = [],
pricingPage = PRICING_PAGE,
reasoning = REASONING,
- prices: Record<string, unknown> | 'throttle-page-2' = PRICES,
+ prices:
+ | Record<string, unknown>
+ | 'throttle-page-2'
+ | 'throttle-page-2-once' = PRICES,
) {
+ let pageTwoCalls = 0
globalThis.fetch = ((input: string, init?: RequestInit) => {
const url = String(input)
urls.push(url)
@@ -107,7 +111,12 @@
new Response(url === AZURE_MODELS_URL ? models : reasoning),