UNPKG

@common-creation/aws-cdk-ses-domain-identity

Version:

Constructs for provisioning and referencing domain identities which can be used in SES RuleSets and Actions Construct.

25 lines 894 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.waitFor = exports.sleep = void 0; const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms)); exports.sleep = sleep; async function waitFor(poller, tester, options) { var _a; const { maxAttempts } = options; const delayInMs = options.delay * 1000; for (let attempt = 0; attempt < maxAttempts; attempt++) { try { const state = await poller(); if (tester(state)) { return state; } } catch (e) { // Swallow errors and continue to next attempt } await (0, exports.sleep)(delayInMs * (attempt ** 2)); } throw new Error((_a = options.failureMessage) !== null && _a !== void 0 ? _a : "Maximum attempts exceeded"); } exports.waitFor = waitFor; //# sourceMappingURL=util.js.map