@aws-amplify/core
Version:
Core category of aws-amplify
1 lines • 1.21 kB
Source Map (JSON)
{"version":3,"file":"jitteredBackoff.mjs","sources":["../../../../../src/clients/middleware/retry/jitteredBackoff.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { jitteredBackoff as jitteredBackoffUtil } from '../../../utils';\n// TODO: [v6] The separate retry utility is used by Data packages now and will replaced by retry middleware.\nconst DEFAULT_MAX_DELAY_MS = 5 * 60 * 1000;\nexport const jitteredBackoff = attempt => {\n const delayFunction = jitteredBackoffUtil(DEFAULT_MAX_DELAY_MS);\n const delay = delayFunction(attempt);\n // The delayFunction returns false when the delay is greater than the max delay(5 mins).\n // In this case, the retry middleware will delay 5 mins instead, as a ceiling of the delay.\n return delay === false ? DEFAULT_MAX_DELAY_MS : delay;\n};\n"],"names":["jitteredBackoffUtil"],"mappings":";;;;;;AAAA;AACA;AAEA;AACA,MAAM,oBAAoB,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI;AAC9B,MAAC,eAAe,GAAG,OAAO,IAAI;AAC1C,IAAI,MAAM,aAAa,GAAGA,iBAAmB,CAAC,oBAAoB,CAAC;AACnE,IAAI,MAAM,KAAK,GAAG,aAAa,CAAC,OAAO,CAAC;AACxC;AACA;AACA,IAAI,OAAO,KAAK,KAAK,KAAK,GAAG,oBAAoB,GAAG,KAAK;AACzD;;;;"}