()
| 20 | * Configure ADMISSION_GATE_MAX_INFLIGHT per pod based on what each pod can sustain. |
| 21 | */ |
| 22 | export function tryAdmit(): AdmissionTicket | null { |
| 23 | if (inflight >= MAX_INFLIGHT) { |
| 24 | return null |
| 25 | } |
| 26 | |
| 27 | inflight++ |
| 28 | let released = false |
| 29 | |
| 30 | return { |
| 31 | release() { |
| 32 | if (released) return |
| 33 | released = true |
| 34 | inflight-- |
| 35 | }, |
| 36 | } |
| 37 | } |
| 38 | |
| 39 | /** |
| 40 | * Returns a 429 response for requests rejected by the admission gate. |
no outgoing calls
no test coverage detected