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

Function retryableOnly

packages/effect/src/graphql/GraphQLClient.ts:321–329  ·  view source on GitHub ↗
(
  schedule: Schedule.Schedule<Output, GraphQLClientError, Error, Env>
)

Source from the content-addressed store, hash-verified

319// errors and fatal errors end the retries before reaching it, so a custom
320// schedule can rely on its input being a `GraphQLClientError`.
321const retryableOnly = <Output, Error, Env>(
322 schedule: Schedule.Schedule<Output, GraphQLClientError, Error, Env>
323): Schedule.Schedule<Output | undefined, unknown, Error, Env> =>
324 Schedule.fromStep(Effect.map(
325 Schedule.toStep(schedule),
326 (step) =>
327 (now: number, input: unknown): Pull.Pull<[Output | undefined, Duration.Duration], Error, Output | undefined, Env> =>
328 isGraphQLClientError(input) && input.isRetryable ? step(now, input) : Cause.done(undefined)
329 ))
330
331// `status` and `headers` are transport metadata, never read from the body.
332const decodeExecutionResult = Schema.decodeUnknownEffect(ExecutionResult.mapFields(Struct.omit(["status", "headers"])))

Callers 1

makeFunction · 0.85

Calls 4

isGraphQLClientErrorFunction · 0.90
stepFunction · 0.50
mapMethod · 0.45
doneMethod · 0.45

Tested by

no test coverage detected