@cellaware/utils 3.0.3 → 3.0.5
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/dist/azure/function.js +3 -1
- package/package.json +1 -1
package/dist/azure/function.js
CHANGED
|
@@ -5,6 +5,7 @@ const RETRY_SLEEP_MS = 3000;
|
|
|
5
5
|
const MAX_RETRIES = 3;
|
|
6
6
|
async function functionFetch(url, req) {
|
|
7
7
|
let res;
|
|
8
|
+
let status = STATUS_SERVICE_UNAVAILABLE;
|
|
8
9
|
let retryNum = 0;
|
|
9
10
|
do {
|
|
10
11
|
if (retryNum > 0) {
|
|
@@ -12,6 +13,7 @@ async function functionFetch(url, req) {
|
|
|
12
13
|
}
|
|
13
14
|
try {
|
|
14
15
|
res = await fetch(url, req);
|
|
16
|
+
status = res.status;
|
|
15
17
|
}
|
|
16
18
|
catch (err) {
|
|
17
19
|
// if at max retries throw the error
|
|
@@ -21,7 +23,7 @@ async function functionFetch(url, req) {
|
|
|
21
23
|
}
|
|
22
24
|
retryNum++;
|
|
23
25
|
} while (retryNum < MAX_RETRIES &&
|
|
24
|
-
(
|
|
26
|
+
(status === STATUS_INTERNAL_SERVER_ERROR || status === STATUS_SERVICE_UNAVAILABLE));
|
|
25
27
|
return res;
|
|
26
28
|
}
|
|
27
29
|
export async function functionFetchJson(url, method, key, body) {
|