dowwntime 1.3.7 → 1.3.9
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/cli.mjs +4 -10
- package/dist/cli.mjs.map +1 -1
- package/dist/index.mjs +4 -10
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -28360,7 +28360,8 @@ const run = async (options) => {
|
|
|
28360
28360
|
try {
|
|
28361
28361
|
const metrics = await measureRequest(url$2, {
|
|
28362
28362
|
method: "GET",
|
|
28363
|
-
timeout: options.timeoutMs ?? 5e3
|
|
28363
|
+
timeout: options.timeoutMs ?? 5e3,
|
|
28364
|
+
headers: { "cache-control": "no-cache" }
|
|
28364
28365
|
});
|
|
28365
28366
|
debug$1(`Measured ${path$4}:`, metrics);
|
|
28366
28367
|
return {
|
|
@@ -28383,16 +28384,9 @@ const run = async (options) => {
|
|
|
28383
28384
|
})(measure);
|
|
28384
28385
|
await Promise.all(Array.from(fetchConfigurations.keys()).map(async (path$4) => {
|
|
28385
28386
|
const results = await Promise.all(Array.from({ length: options.samples ?? 5 }).map(() => throttledMeasure(path$4)));
|
|
28386
|
-
const
|
|
28387
|
-
const q1 = durations[Math.floor(durations.length * .25)] ?? 0;
|
|
28388
|
-
const q3 = durations[Math.floor(durations.length * .75)] ?? 0;
|
|
28389
|
-
const iqr = q3 - q1;
|
|
28390
|
-
const lowerBound = q1 - 1.5 * iqr;
|
|
28391
|
-
const upperBound = q3 + 1.5 * iqr;
|
|
28392
|
-
const filteredResults = results.filter((r) => r && r.durationMs >= lowerBound && r.durationMs <= upperBound);
|
|
28393
|
-
const durationMs = Math.round(filteredResults.reduce((acc, curr) => acc + (curr?.durationMs ?? 0), 0) / filteredResults.length);
|
|
28387
|
+
const durationMs = Math.round(results.reduce((acc, curr) => acc + (curr?.durationMs ?? 0), 0) / results.length);
|
|
28394
28388
|
let status = "down";
|
|
28395
|
-
const statusCode = Math.max(...
|
|
28389
|
+
const statusCode = Math.max(...results.map((r) => r?.statusCode ?? 0));
|
|
28396
28390
|
if (options.getStatus) status = options.getStatus(statusCode, path$4, durationMs);
|
|
28397
28391
|
else status = statusCode >= 200 && statusCode < 300 ? "up" : "down";
|
|
28398
28392
|
const measurement = {
|