main funcions fixes

This commit is contained in:
2025-09-29 22:06:11 +09:00
parent 40e016e128
commit c8c3274527
7995 changed files with 1517998 additions and 1057 deletions

View File

@@ -0,0 +1,21 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.retry = retry;
const CancellationToken_1 = require("./CancellationToken");
async function retry(task, retryCount, interval, backoff = 0, attempt = 0, shouldRetry) {
var _a;
const cancellationToken = new CancellationToken_1.CancellationToken();
try {
return await task();
}
catch (error) {
if (((_a = shouldRetry === null || shouldRetry === void 0 ? void 0 : shouldRetry(error)) !== null && _a !== void 0 ? _a : true) && retryCount > 0 && !cancellationToken.cancelled) {
await new Promise(resolve => setTimeout(resolve, interval + backoff * attempt));
return await retry(task, retryCount - 1, interval, backoff, attempt + 1, shouldRetry);
}
else {
throw error;
}
}
}
//# sourceMappingURL=retry.js.map