MCPcopy
hub / github.com/Effect-TS/effect / start

Method start

packages/effect/src/internal/fiberRuntime.ts:998–1019  ·  view source on GitHub ↗

* Begins execution of the effect associated with this fiber on the current * thread. This can be called to "kick off" execution of a fiber after it has * been created, in hopes that the effect can be executed synchronously. * * This is not the normal way of starting a fiber, but it is us

(effect: Effect.Effect<A, E, R>)

Source from the content-addressed store, hash-verified

996 * express goal of executing the fiber is to synchronously produce its exit.
997 */
998 start<R>(effect: Effect.Effect<A, E, R>): void {
999 if (!this._running) {
1000 this._running = true
1001 const prev = (globalThis as any)[internalFiber.currentFiberURI]
1002 ;(globalThis as any)[internalFiber.currentFiberURI] = this
1003 try {
1004 this.evaluateEffect(effect)
1005 } finally {
1006 this._running = false
1007 ;(globalThis as any)[internalFiber.currentFiberURI] = prev
1008 // Because we're special casing `start`, we have to be responsible
1009 // for spinning up the fiber if there were new messages added to
1010 // the queue between the completion of the effect and the transition
1011 // to the not running state.
1012 if (this._queue.length > 0) {
1013 this.drainQueueLaterOnExecutor()
1014 }
1015 }
1016 } else {
1017 this.tell(FiberMessage.resume(effect))
1018 }
1019 }
1020
1021 /**
1022 * Begins execution of the effect associated with this fiber on in the

Callers 15

handlePortFunction · 0.80
listenFunction · 0.80
PgContainerClass · 0.80
MssqlContainerClass · 0.80
MysqlContainerClass · 0.80
workerRunner.tsFile · 0.80
startFunction · 0.80
RpcServer.tsFile · 0.80
runManuallyLoopFunction · 0.80
nextMethod · 0.80
delaysFunction · 0.80

Calls 4

evaluateEffectMethod · 0.95
tellMethod · 0.95
resumeMethod · 0.80

Tested by 1

runManuallyLoopFunction · 0.64