@xyo-network/xl1-cli-lib 1.12.6 → 1.12.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/dist/node/index.mjs +36 -31
- package/dist/node/index.mjs.map +1 -1
- package/dist/node/orchestration/actor/model/Actor.d.ts +3 -3
- package/dist/node/orchestration/actor/model/Actor.d.ts.map +1 -1
- package/dist/node/orchestration/initServices.d.ts.map +1 -1
- package/dist/node/xl1.mjs +36 -31
- package/dist/node/xl1.mjs.map +1 -1
- package/package.json +7 -7
- package/src/orchestration/actor/model/Actor.ts +32 -24
- package/src/orchestration/initServices.ts +12 -12
package/dist/node/index.mjs
CHANGED
|
@@ -8,14 +8,14 @@ import { Mutex } from "async-mutex";
|
|
|
8
8
|
|
|
9
9
|
// src/orchestration/actor/model/Actor.ts
|
|
10
10
|
import { Base } from "@xylabs/base";
|
|
11
|
-
import { forget } from "@xylabs/forget";
|
|
12
11
|
import { IdLogger } from "@xylabs/logger";
|
|
13
12
|
import { span, spanAsync } from "@xylabs/telemetry";
|
|
14
13
|
var Actor = class extends Base {
|
|
15
14
|
static {
|
|
16
15
|
__name(this, "Actor");
|
|
17
16
|
}
|
|
18
|
-
|
|
17
|
+
_intervals = /* @__PURE__ */ new Map();
|
|
18
|
+
_timeouts = /* @__PURE__ */ new Map();
|
|
19
19
|
_active = false;
|
|
20
20
|
_displayName;
|
|
21
21
|
_id;
|
|
@@ -48,21 +48,20 @@ var Actor = class extends Base {
|
|
|
48
48
|
this.logger?.warn(`Cannot register timer '${timerName}' because actor is not active.`);
|
|
49
49
|
return;
|
|
50
50
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
})
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}), dueTimeMs));
|
|
51
|
+
let running = false;
|
|
52
|
+
const timeoutId = setTimeout(() => {
|
|
53
|
+
const intervalId = setInterval(() => {
|
|
54
|
+
if (!this._active || !this._intervals.has(timerName) || running) return;
|
|
55
|
+
running = true;
|
|
56
|
+
callback().catch((error) => {
|
|
57
|
+
this.logger?.error(`Error in timer '${this.name}:${timerName}': ${error}`);
|
|
58
|
+
}).finally(() => {
|
|
59
|
+
running = false;
|
|
60
|
+
});
|
|
61
|
+
}, periodMs);
|
|
62
|
+
this._intervals.set(timerName, intervalId);
|
|
63
|
+
}, dueTimeMs);
|
|
64
|
+
this._timeouts.set(timerName, timeoutId);
|
|
66
65
|
this.logger?.log(`Timer '${this.name}:${timerName}' registered: first call after ${dueTimeMs}ms, recurring every ${periodMs}ms.`);
|
|
67
66
|
}
|
|
68
67
|
span(name, fn) {
|
|
@@ -87,10 +86,14 @@ var Actor = class extends Base {
|
|
|
87
86
|
await Promise.resolve();
|
|
88
87
|
this._active = false;
|
|
89
88
|
this.logger?.log("Stopping all timers...");
|
|
90
|
-
for (const [,
|
|
91
|
-
clearTimeout(
|
|
89
|
+
for (const [, timeoutRef] of this._timeouts.entries()) {
|
|
90
|
+
clearTimeout(timeoutRef);
|
|
91
|
+
}
|
|
92
|
+
this._timeouts.clear();
|
|
93
|
+
for (const [, intervalRef] of this._intervals.entries()) {
|
|
94
|
+
clearInterval(intervalRef);
|
|
92
95
|
}
|
|
93
|
-
this.
|
|
96
|
+
this._intervals.clear();
|
|
94
97
|
this.logger?.log("Stopped.");
|
|
95
98
|
}
|
|
96
99
|
};
|
|
@@ -1286,16 +1289,6 @@ var RuntimeStatusMonitor = class extends LoggerStatusReporter {
|
|
|
1286
1289
|
};
|
|
1287
1290
|
|
|
1288
1291
|
// src/orchestration/initServices.ts
|
|
1289
|
-
var telemetryConfig = {
|
|
1290
|
-
attributes: {
|
|
1291
|
-
serviceName: "xl1-producer",
|
|
1292
|
-
serviceVersion: "1.0.0"
|
|
1293
|
-
},
|
|
1294
|
-
metricsConfig: {
|
|
1295
|
-
endpoint: "/metrics",
|
|
1296
|
-
port: 9464
|
|
1297
|
-
}
|
|
1298
|
-
};
|
|
1299
1292
|
var isStartable = /* @__PURE__ */ __name((value) => {
|
|
1300
1293
|
return isDefined10(value.start) && typeof value.start === "function";
|
|
1301
1294
|
}, "isStartable");
|
|
@@ -1317,6 +1310,18 @@ var initServices = /* @__PURE__ */ __name(async (context) => {
|
|
|
1317
1310
|
...context,
|
|
1318
1311
|
statusReporter
|
|
1319
1312
|
}));
|
|
1313
|
+
const { otlpEndpoint } = config3.telemetry?.otel ?? {};
|
|
1314
|
+
const telemetryConfig = {
|
|
1315
|
+
attributes: {
|
|
1316
|
+
serviceName: "xl1-producer",
|
|
1317
|
+
serviceVersion: "1.0.0"
|
|
1318
|
+
},
|
|
1319
|
+
otlpEndpoint,
|
|
1320
|
+
metricsConfig: {
|
|
1321
|
+
endpoint: "/metrics",
|
|
1322
|
+
port: 9464
|
|
1323
|
+
}
|
|
1324
|
+
};
|
|
1320
1325
|
const [{ traceProvider, meterProvider }, account] = await Promise.all([
|
|
1321
1326
|
startupSpanAsync7("initTelemetry", () => initTelemetry(telemetryConfig)),
|
|
1322
1327
|
startupSpanAsync7("initAccount", () => initAccount(context))
|
|
@@ -1580,7 +1585,7 @@ var waitForHostPort = /* @__PURE__ */ __name((host, port) => {
|
|
|
1580
1585
|
|
|
1581
1586
|
// src/runCLI.ts
|
|
1582
1587
|
var config;
|
|
1583
|
-
var version = isDefined13("1.12.
|
|
1588
|
+
var version = isDefined13("1.12.6") ? "1.12.6" : "unknown";
|
|
1584
1589
|
var getContextFromConfig = /* @__PURE__ */ __name((config3) => {
|
|
1585
1590
|
const logger = initLogger(config3);
|
|
1586
1591
|
const orchestrator = new Orchestrator(logger);
|