MCPcopy Create free account
hub / github.com/Effect-TS/effect / markShardLocksUnhealthy

Function markShardLocksUnhealthy

packages/cluster/src/Sharding.ts:505–528  ·  view source on GitHub ↗
(cause: Cause.Cause<unknown>)

Source from the content-addressed store, hash-verified

503 )
504
505 const markShardLocksUnhealthy = (cause: Cause.Cause<unknown>) =>
506 Effect.suspend(() => {
507 if (!shardLocksHealthy) return Effect.void
508 shardLocksHealthy = false
509 shardLocksHealthyLatch.unsafeClose()
510
511 const affectedShards = MutableHashSet.fromIterable([...acquiredShards, ...releasingShards])
512 MutableHashSet.clear(selfShards)
513 MutableHashSet.clear(acquiredShards)
514 for (const shardId of affectedShards) {
515 MutableHashSet.add(releasingShards, shardId)
516 MutableHashSet.add(forceReleasingShards, shardId)
517 }
518 updateShardsGauge()
519 activeShardsLatch.unsafeOpen()
520
521 return Effect.gen(function*() {
522 yield* Effect.logError("Shard lock storage is unhealthy", cause)
523 yield* Effect.forkIn(syncSingletons, shardingScope)
524
525 yield* forkInterruptShards([...affectedShards], true)
526 activeShardsLatch.unsafeOpen()
527 })
528 })
529
530 const markShardLocksHealthy = Effect.suspend(() => {
531 if (shardLocksHealthy) return Effect.void

Callers

nothing calls this directly

Calls 5

updateShardsGaugeFunction · 0.85
unsafeCloseMethod · 0.80
clearMethod · 0.80
unsafeOpenMethod · 0.80
addMethod · 0.65

Tested by

no test coverage detected