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

Function execute

packages/cluster/test/SqlRunnerStorage.test.ts:181–198  ·  view source on GitHub ↗
(effect: Effect.Effect<A, E, R>)

Source from the content-addressed store, hash-verified

179 const sql = yield* SqlClient.SqlClient
180 const wrapConnection = (connection: SqlConnection.Connection): SqlConnection.Connection => {
181 const execute = <A, E, R>(effect: Effect.Effect<A, E, R>) =>
182 Effect.suspend(() => {
183 partition.activeQueries++
184 return Effect.suspend(function waitForConnection(): Effect.Effect<A, E, R> {
185 return partition.current
186 ? Effect.andThen(Effect.sleep(5), waitForConnection)
187 : effect
188 }).pipe(
189 Effect.onExit((exit) =>
190 Effect.sync(() => {
191 partition.activeQueries--
192 if (Exit.isFailure(exit) && Exit.isInterrupted(exit)) {
193 partition.interruptedQueries++
194 }
195 })
196 )
197 )
198 })
199 return {
200 ...connection,
201 execute: (...args) => execute(connection.execute(...args)),

Callers 3

wrapConnectionFunction · 0.70
cliApp.tsFile · 0.50

Calls 5

syncMethod · 0.80
isInterruptedMethod · 0.80
pipeMethod · 0.65
sleepMethod · 0.65
onExitMethod · 0.65

Tested by

no test coverage detected