@cellaware/utils 5.0.3 → 5.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 +2 -4
- package/package.json +1 -1
package/dist/azure/function.js
CHANGED
|
@@ -7,8 +7,7 @@ const STATUS_SERVICE_UNAVAILABLE = 503;
|
|
|
7
7
|
const RETRY_SLEEP_MS = 3000;
|
|
8
8
|
const MAX_RETRIES = 3;
|
|
9
9
|
async function functionFetch(url, req) {
|
|
10
|
-
let res;
|
|
11
|
-
let status = STATUS_SERVICE_UNAVAILABLE;
|
|
10
|
+
let res = new Response(null, { status: STATUS_SERVICE_UNAVAILABLE, statusText: 'Service Unavailable' });
|
|
12
11
|
let retryNum = 0;
|
|
13
12
|
do {
|
|
14
13
|
if (retryNum > 0) {
|
|
@@ -16,7 +15,6 @@ async function functionFetch(url, req) {
|
|
|
16
15
|
}
|
|
17
16
|
try {
|
|
18
17
|
res = await fetch(url, req);
|
|
19
|
-
status = res.status;
|
|
20
18
|
}
|
|
21
19
|
catch (err) {
|
|
22
20
|
// if at max retries throw the error
|
|
@@ -26,7 +24,7 @@ async function functionFetch(url, req) {
|
|
|
26
24
|
}
|
|
27
25
|
retryNum++;
|
|
28
26
|
} while (retryNum < MAX_RETRIES &&
|
|
29
|
-
(status === STATUS_INTERNAL_SERVER_ERROR || status === STATUS_SERVICE_UNAVAILABLE));
|
|
27
|
+
(res.status === STATUS_INTERNAL_SERVER_ERROR || res.status === STATUS_SERVICE_UNAVAILABLE));
|
|
30
28
|
return res;
|
|
31
29
|
}
|
|
32
30
|
async function functionStream(url, req, errorBody) {
|