replicas-engine 0.1.1712 → 0.1.1713
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/src/index.js +5 -5
- package/package.json +1 -1
package/dist/src/index.js
CHANGED
|
@@ -61078,20 +61078,20 @@ var KeepAliveService = class _KeepAliveService {
|
|
|
61078
61078
|
}, _KeepAliveService.PING_INTERVAL_MS);
|
|
61079
61079
|
}
|
|
61080
61080
|
async tick() {
|
|
61081
|
-
const
|
|
61082
|
-
if (!
|
|
61081
|
+
const busy = this.activityCheck?.() ?? false;
|
|
61082
|
+
if (!busy && Date.now() - this.lastActivityMs >= _KeepAliveService.PING_INTERVAL_MS) {
|
|
61083
61083
|
if (this.interval) clearInterval(this.interval);
|
|
61084
61084
|
this.interval = null;
|
|
61085
61085
|
return;
|
|
61086
61086
|
}
|
|
61087
|
-
await this.ping();
|
|
61087
|
+
await this.ping(busy ? {} : { idleMs: Date.now() - this.lastActivityMs });
|
|
61088
61088
|
}
|
|
61089
|
-
async ping() {
|
|
61089
|
+
async ping(body) {
|
|
61090
61090
|
if (!ENGINE_ENV.REPLICAS_MONOLITH_URL || !ENGINE_ENV.REPLICAS_ENGINE_SECRET || !ENGINE_ENV.REPLICAS_WORKSPACE_ID) {
|
|
61091
61091
|
return;
|
|
61092
61092
|
}
|
|
61093
61093
|
try {
|
|
61094
|
-
const response = await monolithRequest("/v1/engine/keep-alive", { body
|
|
61094
|
+
const response = await monolithRequest("/v1/engine/keep-alive", { body });
|
|
61095
61095
|
if (!response.ok) {
|
|
61096
61096
|
console.warn(`[KeepAlive] Ping returned ${response.status}`);
|
|
61097
61097
|
}
|