MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / runTick

Function runTick

web/src/server/free-session/admission.ts:158–188  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

156let inFlight = false
157
158function runTick() {
159 if (inFlight) return
160 inFlight = true
161 runAdmissionTick()
162 .then((result) => {
163 // Emit every tick so per-model queue depth and active counts form a
164 // continuous time-series that can be charted over time.
165 // metric=freebuff_waiting_room makes it filterable in the log aggregator.
166 logger.info(
167 {
168 metric: 'freebuff_waiting_room',
169 admitted: result.admitted,
170 expired: result.expired,
171 evictedBanned: result.evictedBanned,
172 queueDepthByModel: result.queueDepthByModel,
173 activeCountByModel: result.activeCountByModel,
174 skipped: result.skipped,
175 },
176 '[FreeSessionAdmission] tick',
177 )
178 })
179 .catch((error) => {
180 logger.warn(
181 { error: error instanceof Error ? error.message : String(error) },
182 '[FreeSessionAdmission] tick failed',
183 )
184 })
185 .finally(() => {
186 inFlight = false
187 })
188}
189
190export function startFreeSessionAdmission(): boolean {
191 if (interval) return true

Callers 1

Calls 1

runAdmissionTickFunction · 0.85

Tested by

no test coverage detected