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

Function onDefect

packages/effect/src/unstable/cluster/internal/entityManager.ts:362–385  ·  view source on GitHub ↗
(cause: Cause.Cause<never>)

Source from the content-addressed store, hash-verified

360 )
361
362 function onDefect(cause: Cause.Cause<never>): Effect.Effect<void> {
363 if (!activeServers.has(address.entityId)) {
364 return endLatch.open
365 }
366 if (isRestartingDueToDefect) {
367 return Effect.void
368 }
369 defectRequestIds = new Set(activeRequests.keys())
370 isRestartingDueToDefect = true
371 const effect = writeRef.rebuildUnsafe()
372 return Effect.logError("Defect in entity, restarting", cause).pipe(
373 Effect.andThen(Effect.ignore(retryDriver(void 0))),
374 Effect.flatMap(() => activeServers.has(address.entityId) ? effect : endLatch.open),
375 Effect.ensuring(Effect.sync(() => {
376 isRestartingDueToDefect = false
377 })),
378 Effect.annotateLogs({
379 module: "EntityManager",
380 address,
381 runner: options.runnerAddress
382 }),
383 Effect.catchCause(onDefect)
384 )
385 }
386
387 const state: EntityState = {
388 scope,

Callers 1

onFromServerFunction · 0.85

Calls 4

rebuildUnsafeMethod · 0.80
pipeMethod · 0.65
hasMethod · 0.45
syncMethod · 0.45

Tested by

no test coverage detected