mentie 0.1.12 → 0.1.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/modules/environment.js +2 -1
- package/modules/promises.js +4 -4
- package/package.json +1 -1
package/modules/environment.js
CHANGED
package/modules/promises.js
CHANGED
|
@@ -10,12 +10,12 @@
|
|
|
10
10
|
* @example
|
|
11
11
|
* make_retryable( do_thing )
|
|
12
12
|
* make_retryable( () => fetch( 'https://api.com/data' ) )
|
|
13
|
-
* @see {@link https://www.npmjs.com/package/promise-retry
|
|
13
|
+
* @see {@link https://www.npmjs.com/package/promise-retry}
|
|
14
14
|
*/
|
|
15
15
|
export async function make_retryable( async_function, { retry_times=5, cooldown_in_s=10, cooldown_entropy=true, logger=null } ) {
|
|
16
16
|
|
|
17
17
|
// Function dependencies
|
|
18
|
-
const Retrier = await import( 'promise-retry' )
|
|
18
|
+
const { default: Retrier } = await import( 'promise-retry' )
|
|
19
19
|
const { wait } = await import( './time.js' )
|
|
20
20
|
|
|
21
21
|
// Set a default logger that does nothing if none was provided
|
|
@@ -67,12 +67,12 @@ export async function make_retryable( async_function, { retry_times=5, cooldown_
|
|
|
67
67
|
* @param {Function} [options.logger] - Progress callback function.
|
|
68
68
|
* @param {boolean} [options.fail_fast=true] - Whether to fail fast or continue with other functions when an error occurs.
|
|
69
69
|
* @returns {Promise<Array>} - A promise that resolves to an array of results from the async functions.
|
|
70
|
-
* @see {@link https://www.npmjs.com/package/promise-parallel-throttle
|
|
70
|
+
* @see {@link https://www.npmjs.com/package/promise-parallel-throttle}
|
|
71
71
|
*/
|
|
72
72
|
export async function throttle_and_retry( async_function_array=[], { max_parallel=2, retry_times, cooldown_in_s, cooldown_entropy, logger, fail_fast=true } ) {
|
|
73
73
|
|
|
74
74
|
// Function dependencies
|
|
75
|
-
const Throttle = await import( 'promise-parallel-throttle' )
|
|
75
|
+
const { default: Throttle } = await import( 'promise-parallel-throttle' )
|
|
76
76
|
|
|
77
77
|
// Create array of retryable functions
|
|
78
78
|
const retryable_async_functions = async_function_array.map( async_function => {
|