MCPcopy Create free account
hub / github.com/codeaashu/claude-code / updateRetryAfter

Function updateRetryAfter

src/services/mockRateLimits.ts:186–207  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

184
185// Helper to update retry-after based on current state
186function updateRetryAfter(): void {
187 const status = mockHeaders['anthropic-ratelimit-unified-status']
188 const overageStatus =
189 mockHeaders['anthropic-ratelimit-unified-overage-status']
190 const reset = mockHeaders['anthropic-ratelimit-unified-reset']
191
192 if (
193 status === 'rejected' &&
194 (!overageStatus || overageStatus === 'rejected') &&
195 reset
196 ) {
197 // Calculate seconds until reset
198 const resetTimestamp = Number(reset)
199 const secondsUntilReset = Math.max(
200 0,
201 resetTimestamp - Math.floor(Date.now() / 1000),
202 )
203 mockHeaders['retry-after'] = String(secondsUntilReset)
204 } else {
205 delete mockHeaders['retry-after']
206 }
207}
208
209// Update the representative claim based on exceeded limits
210function updateRepresentativeClaim(): void {

Callers 1

setMockHeaderFunction · 0.85

Calls 1

maxMethod · 0.80

Tested by

no test coverage detected