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

Function instrumentClient

packages/sql/pg/test/utils.ts:65–73  ·  view source on GitHub ↗
(
  name: string,
  containerId: string,
  inner: Layer.Layer<A, E, R>
)

Source from the content-addressed store, hash-verified

63// Brackets the client layer's finalizers: `disposal start` runs first on close,
64// `disposal done` runs after every finalizer of the inner layer.
65const instrumentClient = <A, E, R>(
66 name: string,
67 containerId: string,
68 inner: Layer.Layer<A, E, R>
69): Effect.Effect<Layer.Layer<A, E, R>, never, Scope.Scope> =>
70 !lifecycleEnabled ? Effect.succeed(inner) : Effect.as(
71 Effect.addFinalizer(() => marker(containerId, `${name} disposal done`)),
72 inner.pipe(Layer.tap(() => Effect.addFinalizer(() => marker(containerId, `${name} disposal start`))))
73 )
74
75// Docker can keep removing after a client timeout, so teardown accepts
76// "removal already in progress" without waiting for removal to finish.

Callers 1

PgContainerClass · 0.85

Calls 4

addFinalizerMethod · 0.80
markerFunction · 0.70
pipeMethod · 0.65
succeedMethod · 0.45

Tested by

no test coverage detected