mirror of
https://github.com/stablyai/orca.git
synced 2026-09-22 00:02:31 +00:00
Phase 6 of the relay split: the relay's deploy/operate surface moves under cloud/ with 24 cloud-* workflows gated on ORCA_CLOUD_OPERATIONS_ENABLED, the Cloud SQL rollout lease action, the relay Terraform root (dual-accept identities for both repositories), scripts, docs, CODEOWNERS, and a terraform validate job in Cloud Verify.
36 lines
1.1 KiB
JavaScript
36 lines
1.1 KiB
JavaScript
const ASSIGNMENT_RETRY_DELAY_MS = 5_100
|
|
|
|
const waitPastAssignmentRateLimit = (schedule) =>
|
|
new Promise((resolve) => schedule(resolve, ASSIGNMENT_RETRY_DELAY_MS))
|
|
|
|
export async function proveRelayLoadRegionBehavior({
|
|
oldClientPeer,
|
|
stickyPeer,
|
|
asiaOrigin,
|
|
scheduleAssignmentRetry = setTimeout
|
|
}) {
|
|
try {
|
|
await oldClientPeer.connect()
|
|
if (!oldClientPeer.assignedCellUrl() || oldClientPeer.assignedCellUrl() === asiaOrigin) {
|
|
throw new Error('unhinted client did not use the US-first path')
|
|
}
|
|
} finally {
|
|
await oldClientPeer.shutdown()
|
|
}
|
|
|
|
try {
|
|
await stickyPeer.connect()
|
|
if (stickyPeer.assignedCellUrl() !== asiaOrigin) {
|
|
throw new Error('preferred Asia client did not reach the Asia cell')
|
|
}
|
|
await waitPastAssignmentRateLimit(scheduleAssignmentRetry)
|
|
const reassigned = await stickyPeer.requestAssignment('us-central1')
|
|
if (reassigned.cellUrl !== asiaOrigin) {
|
|
throw new Error('valid sticky assignment moved after preference changed')
|
|
}
|
|
} finally {
|
|
await stickyPeer.shutdown()
|
|
}
|
|
return { oldClientUsFirst: true, stickyAssignmentPreserved: true }
|
|
}
|