@ancon/wildcat-utils 1.44.13 → 1.44.14
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.
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
* @param numIntervals Number of intervals to generate
|
|
8
8
|
* @param baseSleep Base ms (first interval +/- jitter)
|
|
9
9
|
* @param maxSleep Max ms (greatest allowed interval - jitter)
|
|
10
|
+
* @param repeatCount Number of times to repeat each interval
|
|
10
11
|
* @returns Array with milliseconds entries
|
|
11
12
|
*/
|
|
12
|
-
declare function generateBackoffWithEqualJitter(numIntervals?: number, baseSleep?: number, maxSleep?: number): number[];
|
|
13
|
+
declare function generateBackoffWithEqualJitter(numIntervals?: number, baseSleep?: number, maxSleep?: number, repeatCount?: number): number[];
|
|
13
14
|
export default generateBackoffWithEqualJitter;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const u=require("../number/randomIntFromInterval.js");function m(r=1,f=500,l=3e3,t=1){const n=[],o=Math.ceil(r/t);for(let e=0;e<o;e+=1){const s=Math.min(l,f*2**e),a=s/2+u(0,s/2);let c=t;e===o-1&&(c=r%t||t);for(let i=0;i<c;i+=1)n.push(a)}return n}module.exports=m;
|
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
function
|
|
3
|
-
const e = [];
|
|
4
|
-
for (let
|
|
5
|
-
const
|
|
6
|
-
|
|
1
|
+
import m from "../number/randomIntFromInterval.mjs";
|
|
2
|
+
function p(r = 1, a = 500, c = 3e3, t = 1) {
|
|
3
|
+
const e = [], f = Math.ceil(r / t);
|
|
4
|
+
for (let o = 0; o < f; o += 1) {
|
|
5
|
+
const n = Math.min(c, a * 2 ** o), s = n / 2 + m(0, n / 2);
|
|
6
|
+
let i = t;
|
|
7
|
+
o === f - 1 && (i = r % t || t);
|
|
8
|
+
for (let l = 0; l < i; l += 1)
|
|
9
|
+
e.push(s);
|
|
7
10
|
}
|
|
8
11
|
return e;
|
|
9
12
|
}
|
|
10
13
|
export {
|
|
11
|
-
|
|
14
|
+
p as default
|
|
12
15
|
};
|