X-Git-Url: https://git.squeep.com/?a=blobdiff_plain;f=src%2Fcommon.js;h=0cacc3bf086f2b57f0b10db1ef289c6be7961e15;hb=ac22211a9bc13cfe4dc3e66a55b1c7f9fd84268c;hp=b82b13e35e9b2fbf8224b8ee6407b5e3076ac9a9;hpb=9696c012e6b9a6c58904baa397ca0ebf78112316;p=websub-hub diff --git a/src/common.js b/src/common.js index b82b13e..0cacc3b 100644 --- a/src/common.js +++ b/src/common.js @@ -84,7 +84,7 @@ const topicLeaseDefaults = () => { * @param {Number} jitter * @returns {Number} */ - const attemptRetrySeconds = (attempt, retryBackoffSeconds = [60, 120, 360, 1440, 7200, 43200, 86400], jitter = 0.618) => { +const attemptRetrySeconds = (attempt, retryBackoffSeconds = [60, 120, 360, 1440, 7200, 43200, 86400], jitter = 0.618) => { const maxAttempt = retryBackoffSeconds.length - 1; if (typeof attempt !== 'number' || attempt < 0) { attempt = 0; @@ -103,7 +103,7 @@ const topicLeaseDefaults = () => { * @param {Array} array * @param {Number} per */ - const arrayChunk = (array, per = 1) => { +const arrayChunk = (array, per = 1) => { const nChunks = Math.ceil(array.length / per); return Array.from(Array(nChunks), (_, i) => array.slice(i * per, (i + 1) * per)); } @@ -114,7 +114,7 @@ const topicLeaseDefaults = () => { * @param {Array} dst * @param {Array} src */ - const stackSafePush = (dst, src) => { +const stackSafePush = (dst, src) => { const jsEngineMaxArguments = 2**16; // Current as of Node 12 arrayChunk(src, jsEngineMaxArguments).forEach((items) => { Array.prototype.push.apply(dst, items);