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

Function getOrCreateOwnerState

apps/sim/lib/execution/isolated-vm.ts:457–475  ·  view source on GitHub ↗
(ownerKey: string, ownerWeight: number)

Source from the content-addressed store, hash-verified

455}
456
457function getOrCreateOwnerState(ownerKey: string, ownerWeight: number): OwnerState {
458 const existing = ownerStates.get(ownerKey)
459 if (existing) {
460 existing.weight = Math.max(existing.weight, ownerWeight)
461 return existing
462 }
463
464 const ownerState: OwnerState = {
465 ownerKey,
466 weight: ownerWeight,
467 activeExecutions: 0,
468 queueHead: null,
469 queueTail: null,
470 queueLength: 0,
471 burstRemaining: 0,
472 }
473 ownerStates.set(ownerKey, ownerState)
474 return ownerState
475}
476
477function addOwnerToRing(ownerKey: string) {
478 if (queuedOwnerRing.includes(ownerKey)) return

Callers 1

executeInIsolatedVMFunction · 0.85

Calls 2

getMethod · 0.65
setMethod · 0.65

Tested by

no test coverage detected