MCPcopy Index your code
hub / github.com/Effect-TS/effect / unsafeRebuild

Method unsafeRebuild

packages/cluster/src/internal/resourceRef.ts:58–80  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

56 }
57
58 unsafeRebuild(): Effect.Effect<void, E> {
59 const s = this.state.current
60 if (s._tag === "Closed") {
61 return Effect.interrupt
62 }
63 const prevScope = s.scope
64 const scope = Effect.runSync(Scope.make())
65 this.latch.unsafeClose()
66 MutableRef.set(this.state, { _tag: "Acquiring", scope })
67 return Effect.fiberIdWith((fiberId) => {
68 internalInterruptors.add(fiberId)
69 return Scope.close(prevScope, Exit.void)
70 }).pipe(
71 Effect.andThen(this.acquire(scope)),
72 Effect.flatMap((value) => {
73 if (this.state.current._tag === "Closed") {
74 return Effect.interrupt
75 }
76 MutableRef.set(this.state, { _tag: "Acquired", scope, value })
77 return this.latch.open
78 })
79 )
80 }
81
82 await: Effect.Effect<A> = Effect.suspend(() => {
83 const s = this.state.current

Callers 5

execWithLockConnFunction · 0.80
execWithLockConnValuesFunction · 0.80
onDefectFunction · 0.80

Calls 7

unsafeCloseMethod · 0.80
makeMethod · 0.65
setMethod · 0.65
pipeMethod · 0.65
addMethod · 0.65
closeMethod · 0.65
acquireMethod · 0.65

Tested by

no test coverage detected