mirror of
https://github.com/stablyai/orca.git
synced 2026-10-25 00:03:59 +00:00
fix(orchestration): normalize worker-start timeout defaults
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { MAX_TIMER_DELAY_MS } from '../../../../shared/timer-delay'
|
||||
import { ORCHESTRATION_WORKER_START_CLIENT_GRACE_MS } from '../../../../shared/orchestration-timing-budgets'
|
||||
import {
|
||||
ORCHESTRATION_READINESS_TIMEOUT_MS,
|
||||
ORCHESTRATION_WORKER_START_CLIENT_GRACE_MS
|
||||
} from '../../../../shared/orchestration-timing-budgets'
|
||||
import { resolveFederatedWorkerStartBudgets } from './orchestration-worker-start-budgets'
|
||||
|
||||
describe('worker-start transport budgets', () => {
|
||||
@@ -16,4 +19,16 @@ describe('worker-start transport budgets', () => {
|
||||
'derived timeout must fit'
|
||||
)
|
||||
})
|
||||
|
||||
it('normalizes non-positive requests to the ordinary readiness default', () => {
|
||||
const expectedOuterDeadline =
|
||||
1_000 + ORCHESTRATION_READINESS_TIMEOUT_MS + ORCHESTRATION_WORKER_START_CLIENT_GRACE_MS
|
||||
expect(resolveFederatedWorkerStartBudgets(0, 1_000).readinessTimeoutMs).toBe(
|
||||
ORCHESTRATION_READINESS_TIMEOUT_MS
|
||||
)
|
||||
expect(resolveFederatedWorkerStartBudgets(0, 1_000).outerDeadlineMs).toBe(expectedOuterDeadline)
|
||||
expect(resolveFederatedWorkerStartBudgets(-1, 1_000).outerDeadlineMs).toBe(
|
||||
expectedOuterDeadline
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import {
|
||||
ORCHESTRATION_CONTRACT_PREFLIGHT_TIMEOUT_MS,
|
||||
ORCHESTRATION_READINESS_TIMEOUT_MS,
|
||||
isWorkerStartTimeoutWithinTimerLimit,
|
||||
resolveFederationAttachDeadlineMs,
|
||||
resolveWorkerStartReadinessTimeoutMs,
|
||||
resolveWorkerStartClientTimeoutMs
|
||||
} from '../../../../shared/orchestration-timing-budgets'
|
||||
|
||||
@@ -15,7 +15,9 @@ export function resolveFederatedWorkerStartBudgets(
|
||||
'--timeout-ms is too large for worker-start transport grace; the derived timeout must fit within the timer limit.'
|
||||
)
|
||||
}
|
||||
const readinessTimeoutMs = timeoutMs ?? ORCHESTRATION_READINESS_TIMEOUT_MS
|
||||
// Normalize non-positive/invalid values exactly as the client does so local
|
||||
// and federated transports share the ordinary default contract.
|
||||
const readinessTimeoutMs = resolveWorkerStartReadinessTimeoutMs(timeoutMs)
|
||||
const outerDeadlineMs = nowMs + resolveWorkerStartClientTimeoutMs(readinessTimeoutMs)
|
||||
return {
|
||||
readinessTimeoutMs,
|
||||
|
||||
Reference in New Issue
Block a user