Skip to main content

Instance configuration

import tryo from "tryo";

const runner = tryo({
  circuitBreaker: {
    failureThreshold: 2,
    resetTimeout: 1000,
    halfOpenRequests: 1,
  },
});

Behavior

  • Opens the circuit after failureThreshold consecutive errors
  • During resetTimeout, calls fail immediately
  • In half-open, limits the number of controlled probes

Per call

import { run } from "tryo";

const r = await run(async () => 1, {
  circuitBreaker: { failureThreshold: 3, resetTimeout: 1500 },
});