@rushstack/node-core-library
Advanced tools
Comparing version
# Change Log - @rushstack/node-core-library | ||
This log was last generated on Sat, 14 Dec 2024 01:11:07 GMT and should not be manually modified. | ||
This log was last generated on Thu, 09 Jan 2025 01:10:10 GMT and should not be manually modified. | ||
## 5.10.2 | ||
Thu, 09 Jan 2025 01:10:10 GMT | ||
### Patches | ||
- Provide the `retryCount` parameter to actions executed using `Async.runWithRetriesAsync` | ||
## 5.10.1 | ||
@@ -6,0 +13,0 @@ Sat, 14 Dec 2024 01:11:07 GMT |
@@ -8,5 +8,5 @@ // This file is read by tools that parse documentation comments conforming to the TSDoc standard. | ||
"packageName": "@microsoft/api-extractor", | ||
"packageVersion": "7.48.0" | ||
"packageVersion": "7.49.0" | ||
} | ||
] | ||
} |
@@ -30,4 +30,16 @@ /** | ||
export interface IRunWithRetriesOptions<TResult> { | ||
action: () => Promise<TResult> | TResult; | ||
/** | ||
* The action to be performed. The action is repeatedly executed until it completes without throwing or the | ||
* maximum number of retries is reached. | ||
* | ||
* @param retryCount - The number of times the action has been retried. | ||
*/ | ||
action: (retryCount: number) => Promise<TResult> | TResult; | ||
/** | ||
* The maximum number of times the action should be retried. | ||
*/ | ||
maxRetries: number; | ||
/** | ||
* The delay in milliseconds between retries. | ||
*/ | ||
retryDelayMs?: number; | ||
@@ -34,0 +46,0 @@ } |
@@ -131,10 +131,10 @@ "use strict"; | ||
static async runWithRetriesAsync({ action, maxRetries, retryDelayMs = 0 }) { | ||
let retryCounter = 0; | ||
let retryCount = 0; | ||
// eslint-disable-next-line no-constant-condition | ||
while (true) { | ||
try { | ||
return await action(); | ||
return await action(retryCount); | ||
} | ||
catch (e) { | ||
if (++retryCounter > maxRetries) { | ||
if (++retryCount > maxRetries) { | ||
throw e; | ||
@@ -141,0 +141,0 @@ } |
{ | ||
"name": "@rushstack/node-core-library", | ||
"version": "5.10.1", | ||
"version": "5.10.2", | ||
"description": "Core libraries that every NodeJS toolchain project should use", | ||
@@ -24,4 +24,4 @@ "main": "lib/index.js", | ||
"devDependencies": { | ||
"@rushstack/heft": "0.68.10", | ||
"@rushstack/heft-node-rig": "2.6.44", | ||
"@rushstack/heft": "0.68.12", | ||
"@rushstack/heft-node-rig": "2.6.48", | ||
"@types/fs-extra": "7.0.0", | ||
@@ -28,0 +28,0 @@ "@types/heft-jest": "1.0.1", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1231920
0.15%17400
0.21%