@bigbinary/neeto-playwright-reporter 3.0.0-beta.6 → 3.0.0-beta.7
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/bin/smartOrchestration.js +52 -1
- package/index.cjs.js +1 -1
- package/index.cjs.js.map +1 -1
- package/index.js +1 -1
- package/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,11 +1,62 @@
|
|
|
1
|
+
import https from "https";
|
|
2
|
+
|
|
1
3
|
import axios from "axios";
|
|
4
|
+
import axiosRetry from "axios-retry";
|
|
5
|
+
|
|
6
|
+
const httpsAgent = new https.Agent({
|
|
7
|
+
keepAlive: false,
|
|
8
|
+
timeout: 90000,
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
const smartOrchestrationAxios = axios.create({
|
|
12
|
+
httpsAgent,
|
|
13
|
+
timeout: 90000,
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
axiosRetry(smartOrchestrationAxios, {
|
|
17
|
+
retries: 3,
|
|
18
|
+
retryDelay: retryCount => {
|
|
19
|
+
const delay = Math.min(1000 * Math.pow(2, retryCount - 1), 10000);
|
|
20
|
+
return delay;
|
|
21
|
+
},
|
|
22
|
+
retryCondition: error => {
|
|
23
|
+
if (axiosRetry.isNetworkOrIdempotentRequestError(error)) {
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
if (
|
|
28
|
+
error.code === "ERR_SSL_DECRYPTION_FAILED_OR_BAD_RECORD_MAC" ||
|
|
29
|
+
error.code === "EPROTO" ||
|
|
30
|
+
(error.message && error.message.includes("decryption failed"))
|
|
31
|
+
) {
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (
|
|
36
|
+
error.code === "ETIMEDOUT" ||
|
|
37
|
+
error.code === "ECONNRESET" ||
|
|
38
|
+
error.code === "ECONNABORTED" ||
|
|
39
|
+
error.code === "ENOTFOUND" ||
|
|
40
|
+
error.code === "EAI_AGAIN"
|
|
41
|
+
) {
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const status = error.response?.status;
|
|
46
|
+
if (status) {
|
|
47
|
+
return status >= 500 || status === 408 || status === 429;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return false;
|
|
51
|
+
},
|
|
52
|
+
});
|
|
2
53
|
|
|
3
54
|
const create = ({ payload, apiKey, projectKey }) => {
|
|
4
55
|
const API_BASE_URL =
|
|
5
56
|
process.env.NEETO_PLAYDASH_API_BASE_URL ||
|
|
6
57
|
"https://connect.neetoplaydash.com";
|
|
7
58
|
|
|
8
|
-
return
|
|
59
|
+
return smartOrchestrationAxios.post(
|
|
9
60
|
"/api/v2/reporter/smart_orchestration/distribute_tests",
|
|
10
61
|
{ smart_orchestration: payload },
|
|
11
62
|
{
|