const MAX_ATTEMPTS = 30;
const INTERVAL_MS = 1000;
const policy = Schedule.intersect(
Schedule.untilInput((purchaseExists: boolean) => purchaseExists),
Schedule.recurs(MAX_ATTEMPTS),
Schedule.fixed(INTERVAL_MS),
);
const program = pipe(
// checking if purchase data exists
checkPurchaseExists(purchaseId),
// retrying 30 times with 1000ms interval if can't be found
E.retry(policy),
);
const MAX_ATTEMPTS = 30;
const INTERVAL_MS = 1000;
const policy = Schedule.intersect(
Schedule.untilInput((purchaseExists: boolean) => purchaseExists),
Schedule.recurs(MAX_ATTEMPTS),
Schedule.fixed(INTERVAL_MS),
);
const program = pipe(
// checking if purchase data exists
checkPurchaseExists(purchaseId),
// retrying 30 times with 1000ms interval if can't be found
E.retry(policy),
);