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

Function windowed

packages/effect/src/Schedule.ts:1410–1418  ·  view source on GitHub ↗
(interval: Duration.Input)

Source from the content-addressed store, hash-verified

1408 * @since 2.0.0
1409 */
1410export const windowed = (interval: Duration.Input): Schedule<number> => {
1411 const window = Duration.toMillis(Duration.fromInputUnsafe(interval))
1412 return fromStepWithMetadata(effect.succeed((meta) =>
1413 effect.sync(() => [
1414 meta.attempt - 1,
1415 window === 0 ? Duration.zero : Duration.millis(window - (meta.elapsed % window))
1416 ])
1417 ))
1418}
1419
1420/**
1421 * Returns a new `Schedule` that will recur forever.

Callers

nothing calls this directly

Calls 3

fromStepWithMetadataFunction · 0.85
succeedMethod · 0.45
syncMethod · 0.45

Tested by

no test coverage detected