@pattern-stack/codegen 0.4.5 → 0.4.6
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/runtime/subsystems/index.js +23 -5
- package/dist/runtime/subsystems/index.js.map +1 -1
- package/dist/runtime/subsystems/observability/index.js +23 -5
- package/dist/runtime/subsystems/observability/index.js.map +1 -1
- package/dist/runtime/subsystems/observability/observability.module.js +23 -5
- package/dist/runtime/subsystems/observability/observability.module.js.map +1 -1
- package/dist/runtime/subsystems/observability/reporters/bridge-metrics.reporter.d.ts +9 -1
- package/dist/runtime/subsystems/observability/reporters/bridge-metrics.reporter.js +23 -5
- package/dist/runtime/subsystems/observability/reporters/bridge-metrics.reporter.js.map +1 -1
- package/package.json +1 -1
- package/runtime/subsystems/observability/reporters/bridge-metrics.reporter.ts +23 -3
|
@@ -354,7 +354,8 @@ __export(bridge_metrics_reporter_exports, {
|
|
|
354
354
|
import {
|
|
355
355
|
Inject as Inject15,
|
|
356
356
|
Injectable as Injectable17,
|
|
357
|
-
Logger as Logger8
|
|
357
|
+
Logger as Logger8,
|
|
358
|
+
Optional as Optional7
|
|
358
359
|
} from "@nestjs/common";
|
|
359
360
|
import { and as and6, eq as eq8, gt as gt3, sql as sql7 } from "drizzle-orm";
|
|
360
361
|
var INTERVAL_NAME, DEFAULT_INTERVAL_MS, MIN_INTERVAL_MS, BridgeMetricsReporter;
|
|
@@ -368,7 +369,7 @@ var init_bridge_metrics_reporter = __esm({
|
|
|
368
369
|
DEFAULT_INTERVAL_MS = 6e4;
|
|
369
370
|
MIN_INTERVAL_MS = 1e3;
|
|
370
371
|
BridgeMetricsReporter = class {
|
|
371
|
-
constructor(db, scheduler) {
|
|
372
|
+
constructor(db, scheduler = null) {
|
|
372
373
|
this.db = db;
|
|
373
374
|
this.scheduler = scheduler;
|
|
374
375
|
this.intervalMs = this.resolveIntervalMs();
|
|
@@ -379,6 +380,14 @@ var init_bridge_metrics_reporter = __esm({
|
|
|
379
380
|
logger = new Logger8(BridgeMetricsReporter.name);
|
|
380
381
|
intervalMs;
|
|
381
382
|
lastTickAt;
|
|
383
|
+
/**
|
|
384
|
+
* Timer handle retained as a field when `SchedulerRegistry` isn't
|
|
385
|
+
* available (optional dep). `SchedulerRegistry` is the Nest-idiomatic
|
|
386
|
+
* home for interval cleanup, but global-module wiring across consumer
|
|
387
|
+
* topologies doesn't always make it injectable here — the fallback
|
|
388
|
+
* keeps the reporter self-sufficient.
|
|
389
|
+
*/
|
|
390
|
+
ownedTimer = null;
|
|
382
391
|
onModuleInit() {
|
|
383
392
|
this.logger.log(
|
|
384
393
|
`BridgeMetricsReporter starting (intervalMs=${this.intervalMs}).`
|
|
@@ -387,12 +396,20 @@ var init_bridge_metrics_reporter = __esm({
|
|
|
387
396
|
void this.tick();
|
|
388
397
|
}, this.intervalMs);
|
|
389
398
|
timer.unref?.();
|
|
390
|
-
this.scheduler
|
|
399
|
+
if (this.scheduler) {
|
|
400
|
+
this.scheduler.addInterval(INTERVAL_NAME, timer);
|
|
401
|
+
} else {
|
|
402
|
+
this.ownedTimer = timer;
|
|
403
|
+
}
|
|
391
404
|
}
|
|
392
405
|
onModuleDestroy() {
|
|
393
|
-
if (this.scheduler.getIntervals().includes(INTERVAL_NAME)) {
|
|
406
|
+
if (this.scheduler && this.scheduler.getIntervals().includes(INTERVAL_NAME)) {
|
|
394
407
|
this.scheduler.deleteInterval(INTERVAL_NAME);
|
|
395
408
|
}
|
|
409
|
+
if (this.ownedTimer !== null) {
|
|
410
|
+
clearInterval(this.ownedTimer);
|
|
411
|
+
this.ownedTimer = null;
|
|
412
|
+
}
|
|
396
413
|
}
|
|
397
414
|
/**
|
|
398
415
|
* Run one sampling tick. Public so tests can drive it deterministically
|
|
@@ -474,7 +491,8 @@ var init_bridge_metrics_reporter = __esm({
|
|
|
474
491
|
};
|
|
475
492
|
BridgeMetricsReporter = __decorateClass([
|
|
476
493
|
Injectable17(),
|
|
477
|
-
__decorateParam(0, Inject15(DRIZZLE))
|
|
494
|
+
__decorateParam(0, Inject15(DRIZZLE)),
|
|
495
|
+
__decorateParam(1, Optional7())
|
|
478
496
|
], BridgeMetricsReporter);
|
|
479
497
|
}
|
|
480
498
|
});
|