(ownerKey: string, ownerWeight: number)
| 455 | } |
| 456 | |
| 457 | function 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 | |
| 477 | function addOwnerToRing(ownerKey: string) { |
| 478 | if (queuedOwnerRing.includes(ownerKey)) return |
no test coverage detected