@nxtedition/lib 15.0.23 → 15.0.24
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/app.js +73 -84
- package/package.json +1 -1
package/app.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
const os = require('node:os')
|
|
2
2
|
const net = require('node:net')
|
|
3
|
-
const assert = require('node:assert')
|
|
4
3
|
const stream = require('node:stream')
|
|
5
4
|
const { Buffer } = require('node:buffer')
|
|
6
5
|
const { getDockerSecretsSync } = require('./docker-secrets')
|
|
@@ -408,7 +407,6 @@ module.exports = function (appConfig, onTerminate) {
|
|
|
408
407
|
if (appConfig.status) {
|
|
409
408
|
const rxjs = require('rxjs')
|
|
410
409
|
const rx = require('rxjs/operators')
|
|
411
|
-
const undici = require('undici')
|
|
412
410
|
const fp = require('lodash/fp')
|
|
413
411
|
const hashString = require('./hash')
|
|
414
412
|
|
|
@@ -489,89 +487,80 @@ module.exports = function (appConfig, onTerminate) {
|
|
|
489
487
|
)
|
|
490
488
|
: rxjs.of({}),
|
|
491
489
|
ds
|
|
492
|
-
?
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
id: 'app:ds_record_records',
|
|
506
|
-
level: 40,
|
|
507
|
-
code: 'NXT_DEEPSTREAM_RECORDS_RECORDS',
|
|
508
|
-
msg: 'ds: ' + ds.stats.record.records + ' records',
|
|
509
|
-
})
|
|
510
|
-
}
|
|
511
|
-
|
|
512
|
-
if (ds.stats.record.pruning > 100e3) {
|
|
513
|
-
messages.push({
|
|
514
|
-
id: 'app:ds_record_pruning',
|
|
515
|
-
level: 40,
|
|
516
|
-
code: 'NXT_DEEPSTREAM_RECORDS_PRUNING',
|
|
517
|
-
msg: 'ds: ' + ds.stats.record.pruning + ' pruning',
|
|
518
|
-
})
|
|
519
|
-
}
|
|
520
|
-
|
|
521
|
-
if (ds.stats.record.pending > 10e3) {
|
|
522
|
-
messages.push({
|
|
523
|
-
id: 'app:ds_record_pending',
|
|
524
|
-
level: 40,
|
|
525
|
-
code: 'NXT_DEEPSTREAM_RECORDS_PENDING',
|
|
526
|
-
msg: 'ds: ' + ds.stats.record.pending + ' pending',
|
|
527
|
-
})
|
|
528
|
-
}
|
|
529
|
-
|
|
530
|
-
if (ds.stats.record.updating > 10e3) {
|
|
531
|
-
messages.push({
|
|
532
|
-
id: 'app:ds_record_updating',
|
|
533
|
-
level: 40,
|
|
534
|
-
code: 'NXT_DEEPSTREAM_RECORDS_UPDATING',
|
|
535
|
-
msg: 'ds: ' + ds.stats.record.updating + ' updating',
|
|
536
|
-
})
|
|
537
|
-
}
|
|
538
|
-
|
|
539
|
-
if (ds.stats.record.patching > 10e3) {
|
|
540
|
-
messages.push({
|
|
541
|
-
id: 'app:ds_record_patching',
|
|
542
|
-
level: 40,
|
|
543
|
-
code: 'NXT_DEEPSTREAM_RECORDS_PATCHING',
|
|
544
|
-
msg: 'ds: ' + ds.stats.record.patching + ' patching',
|
|
545
|
-
})
|
|
546
|
-
}
|
|
547
|
-
|
|
548
|
-
try {
|
|
549
|
-
const { body, statusCode } = await client.request({
|
|
550
|
-
method: 'GET',
|
|
551
|
-
path: '/healthcheck',
|
|
552
|
-
})
|
|
553
|
-
await body.dump()
|
|
554
|
-
assert(statusCode >= 200 && statusCode < 300)
|
|
555
|
-
} catch (err) {
|
|
556
|
-
messages.push({
|
|
557
|
-
id: 'app:ds_http_connection',
|
|
490
|
+
? rxjs.fromEvent(ds, 'connectionStateChanged').pipe(
|
|
491
|
+
rxjs.map((connectionState) =>
|
|
492
|
+
connectionState === 'OPEN'
|
|
493
|
+
? [
|
|
494
|
+
{
|
|
495
|
+
id: 'app:ds_connection_state',
|
|
496
|
+
level: 30,
|
|
497
|
+
msg: 'ds: connected',
|
|
498
|
+
},
|
|
499
|
+
]
|
|
500
|
+
: [
|
|
501
|
+
{
|
|
502
|
+
id: 'app:ds_connection_state',
|
|
558
503
|
level: 40,
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
504
|
+
msg: 'ds: connecting',
|
|
505
|
+
},
|
|
506
|
+
],
|
|
507
|
+
),
|
|
508
|
+
)
|
|
509
|
+
: rxjs.of([]),
|
|
510
|
+
ds
|
|
511
|
+
? rxjs.timer(0, 10e3).pipe(
|
|
512
|
+
rx.exhaustMap(async () => {
|
|
513
|
+
const messages = []
|
|
514
|
+
|
|
515
|
+
if (ds.stats.record.records > 100e3) {
|
|
516
|
+
messages.push({
|
|
517
|
+
id: 'app:ds_record_records',
|
|
518
|
+
level: 40,
|
|
519
|
+
code: 'NXT_DEEPSTREAM_RECORDS_RECORDS',
|
|
520
|
+
msg: 'ds: ' + ds.stats.record.records + ' records',
|
|
521
|
+
})
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
if (ds.stats.record.pruning > 100e3) {
|
|
525
|
+
messages.push({
|
|
526
|
+
id: 'app:ds_record_pruning',
|
|
527
|
+
level: 40,
|
|
528
|
+
code: 'NXT_DEEPSTREAM_RECORDS_PRUNING',
|
|
529
|
+
msg: 'ds: ' + ds.stats.record.pruning + ' pruning',
|
|
530
|
+
})
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
if (ds.stats.record.pending > 10e3) {
|
|
534
|
+
messages.push({
|
|
535
|
+
id: 'app:ds_record_pending',
|
|
536
|
+
level: 40,
|
|
537
|
+
code: 'NXT_DEEPSTREAM_RECORDS_PENDING',
|
|
538
|
+
msg: 'ds: ' + ds.stats.record.pending + ' pending',
|
|
539
|
+
})
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
if (ds.stats.record.updating > 10e3) {
|
|
543
|
+
messages.push({
|
|
544
|
+
id: 'app:ds_record_updating',
|
|
545
|
+
level: 40,
|
|
546
|
+
code: 'NXT_DEEPSTREAM_RECORDS_UPDATING',
|
|
547
|
+
msg: 'ds: ' + ds.stats.record.updating + ' updating',
|
|
548
|
+
})
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
if (ds.stats.record.patching > 10e3) {
|
|
552
|
+
messages.push({
|
|
553
|
+
id: 'app:ds_record_patching',
|
|
554
|
+
level: 40,
|
|
555
|
+
code: 'NXT_DEEPSTREAM_RECORDS_PATCHING',
|
|
556
|
+
msg: 'ds: ' + ds.stats.record.patching + ' patching',
|
|
557
|
+
})
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
return messages
|
|
561
|
+
}),
|
|
562
|
+
)
|
|
563
|
+
: rxjs.of([]),
|
|
575
564
|
rxjs.timer(0, 10e3),
|
|
576
565
|
].filter(Boolean),
|
|
577
566
|
)
|