MCPcopy
hub / github.com/simstudioai/sim / nextRotationIndex

Function nextRotationIndex

apps/sim/lib/api-key/byok.ts:28–32  ·  view source on GitHub ↗

* Advances the per-process round-robin cursor for a rotation pool and returns * the next index. Counters are per server instance, which keeps rotation free * of database writes; aggregate load still spreads evenly across keys.

(poolKey: string, poolSize: number)

Source from the content-addressed store, hash-verified

26 * of database writes; aggregate load still spreads evenly across keys.
27 */
28function nextRotationIndex(poolKey: string, poolSize: number): number {
29 const cursor = (rotationCounters.get(poolKey) ?? -1) + 1
30 rotationCounters.set(poolKey, cursor)
31 return cursor % poolSize
32}
33
34/**
35 * Resolves a workspace BYOK key for a provider. When the workspace has

Callers 1

getBYOKKeyFunction · 0.85

Calls 2

getMethod · 0.65
setMethod · 0.65

Tested by

no test coverage detected