INNER CODE UNIT · TypeScript

rejectStickyAssignment

stablyai/orca · cloud/apps/relay/src/app.ts:162

  const rejectStickyAssignment = (context: Context): Response => {
    context.header('Retry-After', String(stickyRetryAfterSeconds))
    return context.json({ error: 'assignments_temporarily_unavailable' }, 503)
  }
  // Aggregate counters cannot separate a handful of pathological hosts from a broad
  // population, so every admission rejection names its host and reason. Keyed on
  // route:lane:reason rather than host, the log stays bounded under load.
  const rejectionLogWindow = new AssignmentRejectionLogWindow<AdmissionRejectionLogEntry>({
    windowMs: ASSIGNMENT_REJECTION_LOG_WINDOW_MS,
    onWindowClosed: ({ suppressed, sample }) => logAssignmentRejection({ ...sample, suppressed })
  })
  const logAdmissionRejection = (input: {
    route: 'assign' | 'resolve'
    lane: 'sticky' | 'placement'
    hinted: boolean
    relayHostId: string
    reason: AssignmentAdmissionRejection | undefined
  }): void => {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…