@ricsam/r5d-worker 0.0.20 → 0.0.21
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/cjs/heartbeat.cjs +36 -0
- package/dist/cjs/package.json +1 -1
- package/dist/mjs/heartbeat.mjs +10 -0
- package/dist/mjs/package.json +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var heartbeat_exports = {};
|
|
20
|
+
__export(heartbeat_exports, {
|
|
21
|
+
WORKER_HEARTBEAT_INTERVAL_MS: () => WORKER_HEARTBEAT_INTERVAL_MS,
|
|
22
|
+
WORKER_HEARTBEAT_TIMEOUT_MS: () => WORKER_HEARTBEAT_TIMEOUT_MS,
|
|
23
|
+
hasWorkerHeartbeatTimedOut: () => hasWorkerHeartbeatTimedOut
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(heartbeat_exports);
|
|
26
|
+
const WORKER_HEARTBEAT_INTERVAL_MS = 15e3;
|
|
27
|
+
const WORKER_HEARTBEAT_TIMEOUT_MS = 45e3;
|
|
28
|
+
function hasWorkerHeartbeatTimedOut(lastHeartbeatAt, now = Date.now(), timeoutMs = WORKER_HEARTBEAT_TIMEOUT_MS) {
|
|
29
|
+
return lastHeartbeatAt !== null && now - lastHeartbeatAt >= timeoutMs;
|
|
30
|
+
}
|
|
31
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
32
|
+
0 && (module.exports = {
|
|
33
|
+
WORKER_HEARTBEAT_INTERVAL_MS,
|
|
34
|
+
WORKER_HEARTBEAT_TIMEOUT_MS,
|
|
35
|
+
hasWorkerHeartbeatTimedOut
|
|
36
|
+
});
|
package/dist/cjs/package.json
CHANGED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
const WORKER_HEARTBEAT_INTERVAL_MS = 15e3;
|
|
2
|
+
const WORKER_HEARTBEAT_TIMEOUT_MS = 45e3;
|
|
3
|
+
function hasWorkerHeartbeatTimedOut(lastHeartbeatAt, now = Date.now(), timeoutMs = WORKER_HEARTBEAT_TIMEOUT_MS) {
|
|
4
|
+
return lastHeartbeatAt !== null && now - lastHeartbeatAt >= timeoutMs;
|
|
5
|
+
}
|
|
6
|
+
export {
|
|
7
|
+
WORKER_HEARTBEAT_INTERVAL_MS,
|
|
8
|
+
WORKER_HEARTBEAT_TIMEOUT_MS,
|
|
9
|
+
hasWorkerHeartbeatTimedOut
|
|
10
|
+
};
|
package/dist/mjs/package.json
CHANGED