dowwntime 1.2.0 → 1.2.1
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 +11 -3
- package/dist/cli.mjs.map +1 -1
- package/dist/index.mjs +10 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -14672,7 +14672,7 @@ var require_dayjs_min = /* @__PURE__ */ __commonJS({ "node_modules/dayjs/dayjs.m
|
|
|
14672
14672
|
|
|
14673
14673
|
//#endregion
|
|
14674
14674
|
//#region node_modules/p-throttle/index.js
|
|
14675
|
-
var import_dayjs_min = /* @__PURE__ */ __toESM(require_dayjs_min()
|
|
14675
|
+
var import_dayjs_min = /* @__PURE__ */ __toESM(require_dayjs_min());
|
|
14676
14676
|
const states = /* @__PURE__ */ new WeakMap();
|
|
14677
14677
|
const signalThrottleds = /* @__PURE__ */ new WeakMap();
|
|
14678
14678
|
const finalizationRegistry = new FinalizationRegistry(({ signalWeakRef, weakReference }) => {
|
|
@@ -14886,6 +14886,8 @@ const debug$1 = debug("dowwntime");
|
|
|
14886
14886
|
const measureRequest = async (url$2, options) => {
|
|
14887
14887
|
const startAt = Date.now();
|
|
14888
14888
|
return await new Promise((resolve$1) => {
|
|
14889
|
+
let firstByteAt;
|
|
14890
|
+
let endAt;
|
|
14889
14891
|
let dnsLookupAt;
|
|
14890
14892
|
let tcpConnectionAt;
|
|
14891
14893
|
let tlsHandshakeAt;
|
|
@@ -14893,12 +14895,18 @@ const measureRequest = async (url$2, options) => {
|
|
|
14893
14895
|
http.request(url$2, options, (res) => {
|
|
14894
14896
|
statusCode = res.statusCode || 0;
|
|
14895
14897
|
res.once("readable", () => {
|
|
14898
|
+
firstByteAt = Date.now();
|
|
14899
|
+
});
|
|
14900
|
+
res.on("end", () => {
|
|
14901
|
+
endAt = Date.now();
|
|
14896
14902
|
resolve$1({
|
|
14897
14903
|
statusCode,
|
|
14898
14904
|
dnsLookupMs: dnsLookupAt - startAt,
|
|
14899
14905
|
tcpConnectionMs: tcpConnectionAt - dnsLookupAt,
|
|
14900
14906
|
tlsHandshakeMs: tlsHandshakeAt - tcpConnectionAt,
|
|
14901
|
-
timeToFirstByteMs:
|
|
14907
|
+
timeToFirstByteMs: firstByteAt - tlsHandshakeAt,
|
|
14908
|
+
contentTransferMs: endAt - firstByteAt,
|
|
14909
|
+
totalTimeMs: endAt - startAt
|
|
14902
14910
|
});
|
|
14903
14911
|
});
|
|
14904
14912
|
}).on("socket", (socket) => {
|
|
@@ -28362,7 +28370,7 @@ const run = async (options) => {
|
|
|
28362
28370
|
timeout: options.timeoutMs ?? 5e3
|
|
28363
28371
|
});
|
|
28364
28372
|
durationMs = metrics.timeToFirstByteMs;
|
|
28365
|
-
if (options.getStatus) status = options.getStatus(metrics.statusCode, path$4, metrics.
|
|
28373
|
+
if (options.getStatus) status = options.getStatus(metrics.statusCode, path$4, metrics.contentTransferMs);
|
|
28366
28374
|
else status = metrics.statusCode >= 200 && metrics.statusCode < 300 ? "up" : "down";
|
|
28367
28375
|
} catch (_error) {
|
|
28368
28376
|
durationMs = Date.now() - start;
|