Pace engine reads under the proxy's rate limit
The proxy allows 10 requests a second per address and answers the rest 503. Limiting how many reads run at once still sent 40-50 a second, since each answers in about 100 ms. Reads now share one pace of 8 a second, actions skip the queue, and a 503 pauses every read for 2 seconds. Results and Schedule share each schedule's production status, and an archived schedule is read once until an action. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -6,6 +6,7 @@ import { MutationCache, QueryClient, QueryClientProvider } from '@tanstack/react
|
||||
import { BrowserRouter } from 'react-router-dom'
|
||||
import { EngineError } from './api/client'
|
||||
import App from './App'
|
||||
import { forgetReads } from './express/results'
|
||||
import { useLang } from './i18n'
|
||||
import './styles/mockup.css'
|
||||
import './styles/app.css'
|
||||
@@ -17,8 +18,12 @@ if (!clerkPubKey) {
|
||||
}
|
||||
|
||||
const queryClient: QueryClient = new QueryClient({
|
||||
// Any action may have spent workspace credits, so the topbar balance is read again after each one.
|
||||
mutationCache: new MutationCache({ onSettled: () => queryClient.invalidateQueries({ queryKey: ['credits'] }) }),
|
||||
mutationCache: new MutationCache({
|
||||
// Runs before the action's own onSuccess, whose invalidations must not get a remembered read.
|
||||
onSuccess: forgetReads,
|
||||
// Any action may have spent workspace credits, so the topbar balance is read again after each one.
|
||||
onSettled: () => queryClient.invalidateQueries({ queryKey: ['credits'] }),
|
||||
}),
|
||||
defaultOptions: {
|
||||
// Retrying a 4xx (auth, credits, validation) only repeats the same answer.
|
||||
queries: {
|
||||
|
||||
Reference in New Issue
Block a user