Avoid early retry for provider tunnel waits
This commit is contained in:
@@ -800,9 +800,6 @@ function canRetryProviderHttpTunnel(method: string, targetPath: string): boolean
|
||||
|
||||
function providerHttpTunnelWaitMs(service: MicroserviceConfig, attempt: number, retryable: boolean): number {
|
||||
const baseTimeoutMs = Math.max(1000, service.backend.timeoutMs);
|
||||
if (!retryable) return baseTimeoutMs + 3000;
|
||||
if (attempt === 1) return Math.min(baseTimeoutMs + 3000, Math.max(5000, Math.floor(baseTimeoutMs * 0.45)));
|
||||
if (attempt === 2) return Math.min(baseTimeoutMs + 3000, Math.max(6000, Math.floor(baseTimeoutMs * 0.7)));
|
||||
return baseTimeoutMs + 3000;
|
||||
}
|
||||
|
||||
@@ -946,7 +943,7 @@ async function providerHttpTunnelMicroserviceResponse(
|
||||
const durationMs = Date.now() - startedAt;
|
||||
if (message === null) {
|
||||
attempts.push({ attempt, requestId, ok: false, reason: reason ?? "timeout", durationMs, timeoutMs });
|
||||
if (retryable && tunnelFailureRetryable(reason) && attempt < maxAttempts) {
|
||||
if (retryable && reason !== "timeout" && tunnelFailureRetryable(reason) && attempt < maxAttempts) {
|
||||
logger("warn", "http_tunnel_retry", {
|
||||
providerId: service.providerId,
|
||||
serviceId: service.id,
|
||||
|
||||
Reference in New Issue
Block a user