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

Function metadataFn

packages/effect/src/Schedule.ts:262–273  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

260}
261
262const metadataFn = () => {
263 let n = 0
264 let previous: number | undefined
265 let start: number | undefined
266 return <In>(now: number, input: In): InputMetadata<In> => {
267 if (start === undefined) start = now
268 const elapsed = now - start
269 const elapsedSincePrevious = previous === undefined ? 0 : now - previous
270 previous = now
271 return { input, attempt: ++n, start, now, elapsed, elapsedSincePrevious }
272 }
273}
274
275/**
276 * Creates a Schedule from a step function that receives metadata about the schedule's execution.

Callers 3

fromStepWithMetadataFunction · 0.85
toStepWithMetadataFunction · 0.85
Schedule.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected