MCPcopy Index your code
hub / github.com/simstudioai/sim / tryAdmit

Function tryAdmit

apps/sim/lib/core/admission/gate.ts:22–37  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

20 * Configure ADMISSION_GATE_MAX_INFLIGHT per pod based on what each pod can sustain.
21 */
22export 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.

Callers 4

route.tsFile · 0.90
route.tsFile · 0.90
route.tsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected