@nsshunt/stsappframework 3.0.90 → 3.0.92
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/authutilsnode.js +15 -14
- package/dist/authutilsnode.js.map +1 -1
- package/dist/influxdb/influxDBManager.js +21 -20
- package/dist/influxdb/influxDBManager.js.map +1 -1
- package/dist/influxdb/influxDBManagerAgent.js +13 -9
- package/dist/influxdb/influxDBManagerAgent.js.map +1 -1
- package/dist/influxdb/influxDBManagerBase.js +6 -2
- package/dist/influxdb/influxDBManagerBase.js.map +1 -1
- package/dist/influxdb/influxDBManagerService.js +14 -10
- package/dist/influxdb/influxDBManagerService.js.map +1 -1
- package/dist/instrumentationsubscriber.js +19 -15
- package/dist/instrumentationsubscriber.js.map +1 -1
- package/dist/kafka/IMKafkaManager.js +6 -2
- package/dist/kafka/IMKafkaManager.js.map +1 -1
- package/dist/kafka/kafkaconsumer.js.map +1 -1
- package/dist/kafka/kafkamanager.js +1 -1
- package/dist/kafka/kafkamanager.js.map +1 -1
- package/dist/kafka/kafkaproducer.js.map +1 -1
- package/dist/kafkatesting/consume.js.map +1 -1
- package/dist/kafkatesting/produce.js +5 -1
- package/dist/kafkatesting/produce.js.map +1 -1
- package/dist/masterprocessbase.js +20 -19
- package/dist/masterprocessbase.js.map +1 -1
- package/dist/middleware/serverNetworkMiddleware.js.map +1 -1
- package/dist/network.js.map +1 -1
- package/dist/processbase.js +8 -8
- package/dist/processbase.js.map +1 -1
- package/dist/publishertransports/publishTransportDirect.js.map +1 -1
- package/dist/publishertransports/publishTransportUtils.js.map +1 -1
- package/dist/server.js +1 -1
- package/dist/server.js.map +1 -1
- package/dist/serverprocessbase.js.map +1 -1
- package/dist/singleprocessbase.js +4 -3
- package/dist/singleprocessbase.js.map +1 -1
- package/dist/socketIoServerHelper.js.map +1 -1
- package/dist/stslatencycontroller.js.map +1 -1
- package/dist/tcpclient/app2.js +2 -2
- package/dist/tcpclient/app2.js.map +1 -1
- package/dist/tcpserver/app.js.map +1 -1
- package/dist/tcpserver/appConfig.js.map +1 -1
- package/dist/tcpserver/appmaster.js +16 -39
- package/dist/tcpserver/appmaster.js.map +1 -1
- package/dist/testing/app.js.map +1 -1
- package/dist/testing/appConfig.js.map +1 -1
- package/dist/testing/appWorkerWSS.js +7 -6
- package/dist/testing/appWorkerWSS.js.map +1 -1
- package/dist/testing/appsolo.js.map +1 -1
- package/dist/testing/singleservertest.test.js +10 -9
- package/dist/testing/singleservertest.test.js.map +1 -1
- package/dist/webworkertesting/app.js.map +1 -1
- package/dist/webworkertesting/worker.js.map +1 -1
- package/dist/workerprocessbase.js +4 -3
- package/dist/workerprocessbase.js.map +1 -1
- package/package.json +13 -13
- package/src/authutilsnode.ts +10 -8
- package/src/influxdb/influxDBManager.ts +18 -16
- package/src/influxdb/influxDBManagerAgent.ts +11 -9
- package/src/influxdb/influxDBManagerBase.ts +4 -2
- package/src/influxdb/influxDBManagerService.ts +12 -10
- package/src/instrumentationsubscriber.ts +14 -11
- package/src/kafka/IMKafkaManager.ts +4 -2
- package/src/kafkatesting/produce.ts +3 -1
- package/src/masterprocessbase.ts +24 -32
- package/src/processbase.ts +9 -7
- package/src/server.ts +1 -1
- package/src/singleprocessbase.ts +5 -3
- package/src/tcpclient/app2.ts +2 -2
- package/src/tcpserver/appmaster.ts +17 -39
- package/src/testing/appWorkerWSS.ts +8 -6
- package/src/testing/singleservertest.test.ts +10 -8
- package/src/workerprocessbase.ts +5 -3
- package/types/authutilsnode.d.ts.map +1 -1
- package/types/commonTypes.d.ts +10 -10
- package/types/commonTypes.d.ts.map +1 -1
- package/types/influxdb/influxDBManager.d.ts.map +1 -1
- package/types/influxdb/influxDBManagerAgent.d.ts.map +1 -1
- package/types/influxdb/influxDBManagerBase.d.ts.map +1 -1
- package/types/influxdb/influxDBManagerService.d.ts.map +1 -1
- package/types/instrumentationsubscriber.d.ts.map +1 -1
- package/types/kafka/IMKafkaManager.d.ts.map +1 -1
- package/types/masterprocessbase.d.ts.map +1 -1
- package/types/processbase.d.ts +2 -2
- package/types/processbase.d.ts.map +1 -1
- package/types/singleprocessbase.d.ts.map +1 -1
- package/types/tcpserver/appmaster.d.ts.map +1 -1
- package/types/testing/appWorkerWSS.d.ts +1 -1
- package/types/testing/appWorkerWSS.d.ts.map +1 -1
- package/types/workerprocessbase.d.ts.map +1 -1
|
@@ -117,6 +117,8 @@ import { InfluxDBManagerBase } from './influxDBManagerBase'
|
|
|
117
117
|
import { IInfluxDBManagerOptions, InstrumentPayload } from './../commonTypes'
|
|
118
118
|
import { ISubscriptionPayload, ISubscriptionKey } from '@nsshunt/stssocketio-client'
|
|
119
119
|
|
|
120
|
+
import chalk from 'chalk';
|
|
121
|
+
|
|
120
122
|
const _logPrefix = 'InfluxDBManagerService:'
|
|
121
123
|
|
|
122
124
|
/*
|
|
@@ -179,7 +181,7 @@ data
|
|
|
179
181
|
|
|
180
182
|
return this.queryApi.collectRows(query)
|
|
181
183
|
} catch (error) {
|
|
182
|
-
console.error(`${_logPrefix}#GetSTSCountGeneric: Error: [${error}]
|
|
184
|
+
console.error(chalk.red(`${_logPrefix}#GetSTSCountGeneric: Error: [${error}]`));
|
|
183
185
|
}
|
|
184
186
|
}
|
|
185
187
|
|
|
@@ -195,7 +197,7 @@ data
|
|
|
195
197
|
|> difference()`;
|
|
196
198
|
return this.queryApi.collectRows(query)
|
|
197
199
|
} catch (error) {
|
|
198
|
-
console.error(`${_logPrefix}#GetSTSHistoGeneric: Error: [${error}]
|
|
200
|
+
console.error(chalk.red(`${_logPrefix}#GetSTSHistoGeneric: Error: [${error}]`));
|
|
199
201
|
}
|
|
200
202
|
}
|
|
201
203
|
|
|
@@ -226,7 +228,7 @@ data
|
|
|
226
228
|
|
|
227
229
|
return this.queryApi.collectRows(query)
|
|
228
230
|
} catch (error) {
|
|
229
|
-
console.error(`${_logPrefix}#GetSTSQuantileGeneric: Error: [${error}]
|
|
231
|
+
console.error(chalk.red(`${_logPrefix}#GetSTSQuantileGeneric: Error: [${error}]`));
|
|
230
232
|
}
|
|
231
233
|
}
|
|
232
234
|
|
|
@@ -241,7 +243,7 @@ data
|
|
|
241
243
|
this.#GetSTSHistoGenericService(SERVICE_STATS_GLOBAL, '')],
|
|
242
244
|
[ ])
|
|
243
245
|
} catch (error) {
|
|
244
|
-
console.error(`${_logPrefix}GetInfluxDBResultsRoot: Error: [${error}]
|
|
246
|
+
console.error(chalk.red(`${_logPrefix}GetInfluxDBResultsRoot: Error: [${error}]`));
|
|
245
247
|
}
|
|
246
248
|
return {
|
|
247
249
|
subscriptionKey,
|
|
@@ -259,7 +261,7 @@ data
|
|
|
259
261
|
this.#GetSTSHistoGenericService(SERVICE_STATS_BY_SERVICE, '')],
|
|
260
262
|
['serviceId'])
|
|
261
263
|
} catch (error) {
|
|
262
|
-
console.error(`${_logPrefix}GetInfluxDBResultsService: Error: [${error}]
|
|
264
|
+
console.error(chalk.red(`${_logPrefix}GetInfluxDBResultsService: Error: [${error}]`));
|
|
263
265
|
}
|
|
264
266
|
return {
|
|
265
267
|
subscriptionKey,
|
|
@@ -279,7 +281,7 @@ data
|
|
|
279
281
|
this.#GetSTSHistoGenericService(SERVICE_STATS_BY_SERVICE_INSTANCE, `and r["serviceId"] == "${serviceId}"`)],
|
|
280
282
|
['serviceId', 'serviceInstanceId'])
|
|
281
283
|
} catch (error) {
|
|
282
|
-
console.error(`${_logPrefix}GetInfluxDBResultsServiceInstances: Error: [${error}]
|
|
284
|
+
console.error(chalk.red(`${_logPrefix}GetInfluxDBResultsServiceInstances: Error: [${error}]`));
|
|
283
285
|
}
|
|
284
286
|
return {
|
|
285
287
|
subscriptionKey,
|
|
@@ -298,7 +300,7 @@ data
|
|
|
298
300
|
this.#GetSTSHistoGenericService(SERVICE_STATS_BY_SERVICE_INSTANCE_PROCESS, `and r["serviceInstanceId"] == "${serviceInstanceId}"`)],
|
|
299
301
|
['serviceId', 'serviceInstanceId', 'serviceInstanceProcessId'])
|
|
300
302
|
} catch (error) {
|
|
301
|
-
console.error(`${_logPrefix}GetInfluxDBResultsServiceInstance: Error: [${error}]
|
|
303
|
+
console.error(chalk.red(`${_logPrefix}GetInfluxDBResultsServiceInstance: Error: [${error}]`));
|
|
302
304
|
}
|
|
303
305
|
return {
|
|
304
306
|
subscriptionKey,
|
|
@@ -361,12 +363,12 @@ data
|
|
|
361
363
|
writeApi.writePoint(point);
|
|
362
364
|
return true;
|
|
363
365
|
} catch (error: any) {
|
|
364
|
-
console.error(`${_logPrefix}OutputInfluxDB: Could not write data point: [${error}]
|
|
365
|
-
console.error(`${JSON.stringify(instrumentPayload.context)}
|
|
366
|
+
console.error(chalk.red(`${_logPrefix}OutputInfluxDB: Could not write data point: [${error}]`));
|
|
367
|
+
console.error(chalk.red(`${JSON.stringify(instrumentPayload.context)}`));
|
|
366
368
|
return false;
|
|
367
369
|
}
|
|
368
370
|
} else {
|
|
369
|
-
console.error(`${_logPrefix}OutputInfluxDBService: Could not write data point as writeClient is null
|
|
371
|
+
console.error(chalk.red(`${_logPrefix}OutputInfluxDBService: Could not write data point as writeClient is null`));
|
|
370
372
|
return false;
|
|
371
373
|
}
|
|
372
374
|
}
|
|
@@ -7,6 +7,9 @@ import { v4 as uuidv4 } from 'uuid';
|
|
|
7
7
|
|
|
8
8
|
import { $Options } from '@nsshunt/stsconfig'
|
|
9
9
|
import { STSOptionsBase } from '@nsshunt/stsutils';
|
|
10
|
+
|
|
11
|
+
import chalk from 'chalk';
|
|
12
|
+
|
|
10
13
|
const goptions = $Options()
|
|
11
14
|
|
|
12
15
|
declare interface IKafkaSubscription {
|
|
@@ -80,12 +83,12 @@ export class InstrumentationSubscriber extends STSOptionsBase {
|
|
|
80
83
|
const kafka = subscription.kafka;
|
|
81
84
|
if (kafka) {
|
|
82
85
|
// Un-Subscribe from this kafka topic
|
|
83
|
-
this.#Log(`InstrumentationSubscriber:#UnSubscribeKafka(): Unsubscribe from Kafka topc: [${kafka.kafkaTopic}] Starting
|
|
86
|
+
this.#Log(chalk.yellow(`InstrumentationSubscriber:#UnSubscribeKafka(): Unsubscribe from Kafka topc: [${kafka.kafkaTopic}] Starting`));
|
|
84
87
|
await kafka.kafkaConsumer?.Stop();
|
|
85
88
|
await kafka.kafkaConsumer?.Disconnect();
|
|
86
|
-
this.#Log(`InstrumentationSubscriber:#UnSubscribeKafka(): Unsubscribe from Kafka topc: [${kafka.kafkaTopic}] Completed
|
|
89
|
+
this.#Log(chalk.yellow(`InstrumentationSubscriber:#UnSubscribeKafka(): Unsubscribe from Kafka topc: [${kafka.kafkaTopic}] Completed.`));
|
|
87
90
|
} else {
|
|
88
|
-
this.#Log(`InstrumentationSubscriber:#UnSubscribeKafka(): Kafka details do not exist for this topc: [${JSON.stringify(subscription.subscriptionKey)}]
|
|
91
|
+
this.#Log(chalk.magenta(`InstrumentationSubscriber:#UnSubscribeKafka(): Kafka details do not exist for this topc: [${JSON.stringify(subscription.subscriptionKey)}].`));
|
|
89
92
|
}
|
|
90
93
|
};
|
|
91
94
|
return unsubscribeKafka();
|
|
@@ -126,18 +129,18 @@ export class InstrumentationSubscriber extends STSOptionsBase {
|
|
|
126
129
|
} as IKafkaData
|
|
127
130
|
});
|
|
128
131
|
} else {
|
|
129
|
-
this.#Log(`InstrumentationSubscriber:#SubscribeKafka(): Invalid message format from Kafka data, topic: [${topic}] and key: [${key}] do not match
|
|
132
|
+
this.#Log(chalk.red(`InstrumentationSubscriber:#SubscribeKafka(): Invalid message format from Kafka data, topic: [${topic}] and key: [${key}] do not match`));
|
|
130
133
|
}
|
|
131
134
|
} else {
|
|
132
|
-
this.#Log(`InstrumentationSubscriber:#SubscribeKafka(): Invalid message format from Kafka data, topic: [${topic}], key: [${key}], value: [${value}]
|
|
135
|
+
this.#Log(chalk.red(`InstrumentationSubscriber:#SubscribeKafka(): Invalid message format from Kafka data, topic: [${topic}], key: [${key}], value: [${value}]`));
|
|
133
136
|
}
|
|
134
137
|
} catch (error) {
|
|
135
|
-
this.#Log(`InstrumentationSubscriber:#SubscribeKafka(): Error: [${error}]
|
|
138
|
+
this.#Log(chalk.red(`InstrumentationSubscriber:#SubscribeKafka(): Error: [${error}]`));
|
|
136
139
|
}
|
|
137
140
|
});
|
|
138
|
-
this.#Log(`InstrumentationSubscriber:#SubscribeKafka(): Subscribe to Kafka topc: [${kafka.kafkaTopic}] Completed
|
|
141
|
+
this.#Log(chalk.yellow(`InstrumentationSubscriber:#SubscribeKafka(): Subscribe to Kafka topc: [${kafka.kafkaTopic}] Completed`));
|
|
139
142
|
} else {
|
|
140
|
-
this.#Log(`InstrumentationSubscriber:#SubscribeKafka(): Could not subscribe to Kafka topc, missing combinedKey for topic: [${JSON.stringify(subscription.subscriptionKey)}]
|
|
143
|
+
this.#Log(chalk.magenta(`InstrumentationSubscriber:#SubscribeKafka(): Could not subscribe to Kafka topc, missing combinedKey for topic: [${JSON.stringify(subscription.subscriptionKey)}]`));
|
|
141
144
|
}
|
|
142
145
|
}
|
|
143
146
|
return kafkaSubscribe();
|
|
@@ -212,7 +215,7 @@ export class InstrumentationSubscriber extends STSOptionsBase {
|
|
|
212
215
|
}
|
|
213
216
|
}
|
|
214
217
|
} catch (error) {
|
|
215
|
-
this.#Log(`InstrumentationSubscriber:#ExecuteSubscriptions(): Error: [${error}], [${JSON.stringify(retVal)}]
|
|
218
|
+
this.#Log(chalk.red(`InstrumentationSubscriber:#ExecuteSubscriptions(): Error: [${error}], [${JSON.stringify(retVal)}]`));
|
|
216
219
|
}
|
|
217
220
|
}
|
|
218
221
|
|
|
@@ -223,7 +226,7 @@ export class InstrumentationSubscriber extends STSOptionsBase {
|
|
|
223
226
|
}
|
|
224
227
|
if (this.#subscriptions[subscriptionKey.id]) {
|
|
225
228
|
// Subscription already exists - ignoring
|
|
226
|
-
this.#Log(`InstrumentationSubscriber.Subscribe(): Subscription already exists: [${subscriptionKey.id}] - ignoring
|
|
229
|
+
this.#Log(chalk.magenta(`InstrumentationSubscriber.Subscribe(): Subscription already exists: [${subscriptionKey.id}] - ignoring.`));
|
|
227
230
|
} else {
|
|
228
231
|
this.#subscriptions[subscriptionKey.id] = {
|
|
229
232
|
subscriptionKey,
|
|
@@ -250,7 +253,7 @@ export class InstrumentationSubscriber extends STSOptionsBase {
|
|
|
250
253
|
|
|
251
254
|
UnSubscribe(subscriptionKey: ISubscriptionKey) {
|
|
252
255
|
if (!this.#subscriptions[subscriptionKey.id]) {
|
|
253
|
-
this.#Log(`UnSubscribe(): Warning, subscriptionKey.id: [${subscriptionKey.id}] does not exist within subscription records
|
|
256
|
+
this.#Log(chalk.magenta(`UnSubscribe(): Warning, subscriptionKey.id: [${subscriptionKey.id}] does not exist within subscription records`));
|
|
254
257
|
} else {
|
|
255
258
|
if (subscriptionKey.topic.localeCompare(SubscriptionTopic.LogProcessing) === 0) {
|
|
256
259
|
this.#UnSubscribeKafka(this.#subscriptions[subscriptionKey.id]);
|
|
@@ -9,6 +9,8 @@ import { KafkaProducer } from './kafkaproducer'
|
|
|
9
9
|
import { JSONObject } from '@nsshunt/stsutils'
|
|
10
10
|
import { v4 as uuidv4 } from 'uuid';
|
|
11
11
|
|
|
12
|
+
import chalk from 'chalk';
|
|
13
|
+
|
|
12
14
|
import { $Options } from '@nsshunt/stsconfig'
|
|
13
15
|
const goptions = $Options()
|
|
14
16
|
|
|
@@ -69,7 +71,7 @@ export class IMKafkaManager {
|
|
|
69
71
|
}
|
|
70
72
|
}
|
|
71
73
|
} catch (error) {
|
|
72
|
-
console.error(`${_logPrefix}#Terminate: Error: [${error}]
|
|
74
|
+
console.error(chalk.red(`${_logPrefix}#Terminate: Error: [${error}]`));
|
|
73
75
|
}
|
|
74
76
|
}
|
|
75
77
|
|
|
@@ -145,7 +147,7 @@ export class IMKafkaManager {
|
|
|
145
147
|
}
|
|
146
148
|
return true;
|
|
147
149
|
} catch (error: any) {
|
|
148
|
-
console.error(`${_logPrefix}OutputLogs: Could not output log data to kafka: [${error}]
|
|
150
|
+
console.error(chalk.red(`${_logPrefix}OutputLogs: Could not output log data to kafka: [${error}]`));
|
|
149
151
|
return false;
|
|
150
152
|
}
|
|
151
153
|
}
|
|
@@ -56,6 +56,8 @@ import { KafkaManager } from './../kafka/kafkamanager'
|
|
|
56
56
|
|
|
57
57
|
import 'colors'
|
|
58
58
|
|
|
59
|
+
import chalk from 'chalk';
|
|
60
|
+
|
|
59
61
|
async function Sleep(milliseconds = 1000) {
|
|
60
62
|
return new Promise(resolve => setTimeout(resolve, milliseconds))
|
|
61
63
|
}
|
|
@@ -92,7 +94,7 @@ const runme = async () => {
|
|
|
92
94
|
for (let i=0; i < count; i++) {
|
|
93
95
|
if (i % 100 === 0) console.log(i);
|
|
94
96
|
const retVal = await producer.SendMessages(TOPIC, [
|
|
95
|
-
{ key: 'key1', value: `hello world - ${i}
|
|
97
|
+
{ key: 'key1', value: chalk.green(`hello world - ${i}`) },
|
|
96
98
|
{ key: 'key2', value: 'hey hey! -2' },
|
|
97
99
|
{ key: 'key3', value: 'hey hey! -3' },
|
|
98
100
|
{ key: 'key4', value: 'hey hey! -4' },
|
package/src/masterprocessbase.ts
CHANGED
|
@@ -7,9 +7,7 @@ import axios from 'axios';
|
|
|
7
7
|
|
|
8
8
|
import cluster, { Worker } from 'node:cluster'
|
|
9
9
|
|
|
10
|
-
import
|
|
11
|
-
|
|
12
|
-
import colors from 'colors'
|
|
10
|
+
import chalk from 'chalk';
|
|
13
11
|
|
|
14
12
|
import express from 'express'
|
|
15
13
|
|
|
@@ -24,7 +22,6 @@ const goptions = $Options()
|
|
|
24
22
|
import debugModule from 'debug'
|
|
25
23
|
|
|
26
24
|
import { Gauge, GaugeTypes, InstrumentGaugeTelemetry, InstrumentGaugeOptions, InstrumentHistogramTelemetry } from '@nsshunt/stsinstrumentation'
|
|
27
|
-
import { GetFirstNetworkInterface } from './network'
|
|
28
25
|
|
|
29
26
|
import { ProcessOptions, STSServerType } from './processoptions'
|
|
30
27
|
import { ProcessBase } from './processbase';
|
|
@@ -32,7 +29,6 @@ import { IMasterProcessBase } from './commonTypes';
|
|
|
32
29
|
|
|
33
30
|
import { InstrumentDefinitions } from '@nsshunt/stspublisherserver'
|
|
34
31
|
import { IPCMessagePayload, IPCMessageCommand } from './commonTypes'
|
|
35
|
-
import { REQUEST_HEADER_FIELDS_TOO_LARGE } from "http-status-codes";
|
|
36
32
|
|
|
37
33
|
|
|
38
34
|
export class MasterProcessBase extends ProcessBase implements IMasterProcessBase
|
|
@@ -190,15 +186,15 @@ export class MasterProcessBase extends ProcessBase implements IMasterProcessBase
|
|
|
190
186
|
,httpsAgent: this.#httpsAgent
|
|
191
187
|
});
|
|
192
188
|
if (retVal.status !== 200) {
|
|
193
|
-
this.#debug(`Error (MasterProcessBase:#GetLatency): Invalid response from server: [${retVal.status}]
|
|
189
|
+
this.#debug(chalk.magenta(`Error (MasterProcessBase:#GetLatency): Invalid response from server: [${retVal.status}]`));
|
|
194
190
|
return null;
|
|
195
191
|
}
|
|
196
192
|
return retVal.data.detail;
|
|
197
193
|
} catch (error: any) {
|
|
198
|
-
this.#debug(`Error (MasterProcessBase:#GetLatency:catch): [${error}]
|
|
199
|
-
this.#debug(` url: [${url}]
|
|
194
|
+
this.#debug(chalk.red(`Error (MasterProcessBase:#GetLatency:catch): [${error}]`));
|
|
195
|
+
this.#debug(chalk.red(` url: [${url}]`));
|
|
200
196
|
if (error.response && error.response.data) {
|
|
201
|
-
this.#debug(` Details: [${JSON.stringify(error.response.data)}]
|
|
197
|
+
this.#debug(chalk.red(` Details: [${JSON.stringify(error.response.data)}]`));
|
|
202
198
|
}
|
|
203
199
|
}
|
|
204
200
|
}
|
|
@@ -236,11 +232,11 @@ export class MasterProcessBase extends ProcessBase implements IMasterProcessBase
|
|
|
236
232
|
worker.process.send( { command } );
|
|
237
233
|
return true;
|
|
238
234
|
} else {
|
|
239
|
-
this.LogEx(`Could not kill worker with id: [${id}]. The process does not exists
|
|
235
|
+
this.LogEx(chalk.red(`Could not kill worker with id: [${id}]. The process does not exists`));
|
|
240
236
|
return false;
|
|
241
237
|
}
|
|
242
238
|
} else {
|
|
243
|
-
this.LogEx(`Could not kill worker with id: [${id}]. Worker does not exist within workers collection
|
|
239
|
+
this.LogEx(chalk.red(`Could not kill worker with id: [${id}]. Worker does not exist within workers collection`));
|
|
244
240
|
return false;
|
|
245
241
|
}
|
|
246
242
|
}
|
|
@@ -342,7 +338,7 @@ export class MasterProcessBase extends ProcessBase implements IMasterProcessBase
|
|
|
342
338
|
}
|
|
343
339
|
default : {
|
|
344
340
|
const errorMessage = `Could not process command: [${iPCMessagePayload.command}].`;
|
|
345
|
-
this.#debug(` ${errorMessage}
|
|
341
|
+
this.#debug(chalk.red(` ${errorMessage}`));
|
|
346
342
|
throw new Error(errorMessage);
|
|
347
343
|
}
|
|
348
344
|
}
|
|
@@ -381,9 +377,9 @@ export class MasterProcessBase extends ProcessBase implements IMasterProcessBase
|
|
|
381
377
|
// Only handle request/response message types here ...
|
|
382
378
|
if (payload.requestResponse) {
|
|
383
379
|
const iPCMessagePayload: IPCMessagePayload = payload as IPCMessagePayload;
|
|
384
|
-
this.#debug(`Received message with id: [${iPCMessagePayload.id}] from worker: [${worker.process.pid}]. Details: [${JSON.stringify(iPCMessagePayload)}]
|
|
380
|
+
this.#debug(chalk.yellow(`Received message with id: [${iPCMessagePayload.id}] from worker: [${worker.process.pid}]. Details: [${JSON.stringify(iPCMessagePayload)}]`));
|
|
385
381
|
const response: IPCMessagePayload = await this.#processIPCCommand(iPCMessagePayload);
|
|
386
|
-
this.#debug(`Sending response message with id: [${iPCMessagePayload.id}] to worker: [${worker.process.pid}]. Details: [${JSON.stringify(response)}]
|
|
382
|
+
this.#debug(chalk.green(`Sending response message with id: [${iPCMessagePayload.id}] to worker: [${worker.process.pid}]. Details: [${JSON.stringify(response)}]`));
|
|
387
383
|
worker.send(response);
|
|
388
384
|
} else {
|
|
389
385
|
this.#WorkerMessageEvent(payload);
|
|
@@ -447,25 +443,21 @@ export class MasterProcessBase extends ProcessBase implements IMasterProcessBase
|
|
|
447
443
|
LogEx(`Worker process ${worker.process.pid} is online`);
|
|
448
444
|
});
|
|
449
445
|
|
|
450
|
-
cluster.on('exit', (worker, code, signal) =>
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
{
|
|
454
|
-
LogEx(`Process ${worker.process.pid} terminated gracefully with code: ${code}, signal: ${signal}`.green);
|
|
446
|
+
cluster.on('exit', (worker, code, signal) => {
|
|
447
|
+
if ((code !== null && code === 0) || (signal === 'SIGINT')) {
|
|
448
|
+
LogEx(chalk.green(`Process ${worker.process.pid} terminated gracefully with code: ${code}, signal: ${signal}`));
|
|
455
449
|
this.DecWorkers();
|
|
456
|
-
} else if ((code !== null && code === 15) || (signal === 'SIGTERM'))
|
|
457
|
-
{
|
|
450
|
+
} else if ((code !== null && code === 15) || (signal === 'SIGTERM')) {
|
|
458
451
|
this.DecWorkers();
|
|
459
|
-
LogEx(`Process ${worker.process.pid} terminated with code: ${code}, signal: ${signal}
|
|
452
|
+
LogEx(chalk.red(`Process ${worker.process.pid} terminated with code: ${code}, signal: ${signal}`));
|
|
460
453
|
} else {
|
|
461
454
|
this.DecWorkers();
|
|
462
|
-
LogEx(`worker ${worker.process.pid} died
|
|
463
|
-
LogEx(`code: ${code}
|
|
464
|
-
LogEx(`signal: ${signal}
|
|
465
|
-
LogEx('process terminated in an error state'
|
|
466
|
-
if (goptions.respawnOnFail === true)
|
|
467
|
-
|
|
468
|
-
LogEx(`Attemping to respawn worker`);
|
|
455
|
+
LogEx(chalk.red(`worker ${worker.process.pid} died`));
|
|
456
|
+
LogEx(chalk.red(`code: ${code}`));
|
|
457
|
+
LogEx(chalk.red(`signal: ${signal}`));
|
|
458
|
+
LogEx(chalk.red('process terminated in an error state'));
|
|
459
|
+
if (goptions.respawnOnFail === true) {
|
|
460
|
+
LogEx(chalk.magenta(`Attemping to respawn worker`));
|
|
469
461
|
this.#SpawnWorker();
|
|
470
462
|
}
|
|
471
463
|
}
|
|
@@ -564,9 +556,9 @@ export class MasterProcessBase extends ProcessBase implements IMasterProcessBase
|
|
|
564
556
|
{
|
|
565
557
|
if (code === 0)
|
|
566
558
|
{
|
|
567
|
-
LogEx(`Main Process: ${process.pid} terminated gracefully with code: ${code}
|
|
559
|
+
LogEx(chalk.green(`Main Process: ${process.pid} terminated gracefully with code: ${code}`));
|
|
568
560
|
} else {
|
|
569
|
-
LogEx(`Main Process: ${process.pid} terminated with code: ${code}
|
|
561
|
+
LogEx(chalk.red(`Main Process: ${process.pid} terminated with code: ${code}`));
|
|
570
562
|
}
|
|
571
563
|
});
|
|
572
564
|
|
|
@@ -578,7 +570,7 @@ export class MasterProcessBase extends ProcessBase implements IMasterProcessBase
|
|
|
578
570
|
|
|
579
571
|
this.MasterStarted();
|
|
580
572
|
|
|
581
|
-
LogEx(`Master process:${process.pid} started
|
|
573
|
+
LogEx(chalk.green(`Master process:${process.pid} started`));
|
|
582
574
|
}
|
|
583
575
|
|
|
584
576
|
BroadcastDataToWorkers = (command: any, data: any) => {
|
package/src/processbase.ts
CHANGED
|
@@ -7,6 +7,8 @@ import colors from 'colors'
|
|
|
7
7
|
import si from 'systeminformation' // https://systeminformation.io/
|
|
8
8
|
import { GetFirstNetworkInterface } from './network'
|
|
9
9
|
|
|
10
|
+
import chalk from 'chalk';
|
|
11
|
+
|
|
10
12
|
import debugModule from 'debug'
|
|
11
13
|
const debug = debugModule(`proc:${process.pid}:processBase`);
|
|
12
14
|
|
|
@@ -76,10 +78,10 @@ export abstract class ProcessBase extends STSOptionsBase implements IProcessBase
|
|
|
76
78
|
if (cluster.isPrimary)
|
|
77
79
|
{
|
|
78
80
|
prefix = 'M';
|
|
79
|
-
col =
|
|
81
|
+
col = chalk.bold.cyan;
|
|
80
82
|
} else {
|
|
81
83
|
prefix = 'W';
|
|
82
|
-
col =
|
|
84
|
+
col = chalk.green;
|
|
83
85
|
}
|
|
84
86
|
const msgEx = col(`${prefix}(${process.pid}) [${appName}]: ${msg}`);
|
|
85
87
|
debug(msgEx);
|
|
@@ -334,13 +336,13 @@ export abstract class ProcessBase extends STSOptionsBase implements IProcessBase
|
|
|
334
336
|
try {
|
|
335
337
|
const retVal = await (this.accessLayer as PGAccessLayer).getResourceCount();
|
|
336
338
|
if (retVal.status !== StatusCodes.OK) {
|
|
337
|
-
this.LogEx(`Unable to get resources from the database. Is the database running? [${JSON.stringify(retVal)}]
|
|
339
|
+
this.LogEx(chalk.red(`Unable to get resources from the database. Is the database running? [${JSON.stringify(retVal)}]`));
|
|
338
340
|
exit(1);
|
|
339
341
|
} else {
|
|
340
|
-
this.LogEx(`Database connection successful. Resources: [${retVal.detail.count}]
|
|
342
|
+
this.LogEx(chalk.green(`Database connection successful. Resources: [${retVal.detail.count}]`));
|
|
341
343
|
}
|
|
342
344
|
} catch (error) {
|
|
343
|
-
this.LogEx(`Unable to get resources from the database. Is the database running? Error: [${error}]
|
|
345
|
+
this.LogEx(chalk.red(`Unable to get resources from the database. Is the database running? Error: [${error}]`));
|
|
344
346
|
exit(1);
|
|
345
347
|
}
|
|
346
348
|
})();
|
|
@@ -402,9 +404,9 @@ export abstract class ProcessBase extends STSOptionsBase implements IProcessBase
|
|
|
402
404
|
GetSignalColour = (signal: any) => {
|
|
403
405
|
let msgcolor = null;
|
|
404
406
|
if (signal === 'SIGINT') {
|
|
405
|
-
msgcolor =
|
|
407
|
+
msgcolor = chalk.yellow;
|
|
406
408
|
} else {
|
|
407
|
-
msgcolor =
|
|
409
|
+
msgcolor = chalk.red;
|
|
408
410
|
}
|
|
409
411
|
return msgcolor;
|
|
410
412
|
};
|
package/src/server.ts
CHANGED
|
@@ -33,7 +33,7 @@ export class STSExpressServer
|
|
|
33
33
|
});
|
|
34
34
|
|
|
35
35
|
serverNetworkMiddleware.on(ServerNetworkMiddlewareEventName.UpdateInstrument_SERVER_NET_VAL, (data: ISocketRecord) => {
|
|
36
|
-
//console.log(`serverNetworkMiddleware: [${JSON.stringify(data)}]
|
|
36
|
+
//console.log(chalk.magenta(`serverNetworkMiddleware: [${JSON.stringify(data)}]`));
|
|
37
37
|
stsApp.UpdateInstrument(Gauge.NETWORK_RX_GAUGE, {
|
|
38
38
|
Inc: data.requestBytesRead
|
|
39
39
|
} as InstrumentGaugeTelemetry);
|
package/src/singleprocessbase.ts
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
import { $Options } from '@nsshunt/stsconfig'
|
|
3
3
|
const goptions = $Options()
|
|
4
4
|
|
|
5
|
+
import chalk from 'chalk';
|
|
6
|
+
|
|
5
7
|
import { Gauge, GaugeTypes, InstrumentGaugeOptions, InstrumentGaugeTelemetry } from '@nsshunt/stsinstrumentation'
|
|
6
8
|
|
|
7
9
|
import { ProcessOptions } from './processoptions'
|
|
@@ -97,9 +99,9 @@ export class SingleProcessBase extends ServerProcessBase implements ISingleProce
|
|
|
97
99
|
|
|
98
100
|
process.on('exit', (code) => {
|
|
99
101
|
if (code === 0) {
|
|
100
|
-
this.LogEx(`Main Process: ${process.pid} terminated gracefully with code: ${code}
|
|
102
|
+
this.LogEx(chalk.green(`Main Process: ${process.pid} terminated gracefully with code: ${code}`));
|
|
101
103
|
} else {
|
|
102
|
-
this.LogEx(`Main Process: ${process.pid} terminated with code: ${code}
|
|
104
|
+
this.LogEx(chalk.red(`Main Process: ${process.pid} terminated with code: ${code}`));
|
|
103
105
|
}
|
|
104
106
|
});
|
|
105
107
|
|
|
@@ -107,7 +109,7 @@ export class SingleProcessBase extends ServerProcessBase implements ISingleProce
|
|
|
107
109
|
|
|
108
110
|
this.ProcessStarted();
|
|
109
111
|
|
|
110
|
-
this.LogEx(`Main process:${process.pid} started
|
|
112
|
+
this.LogEx(chalk.green(`Main process:${process.pid} started`));
|
|
111
113
|
}
|
|
112
114
|
|
|
113
115
|
async TerminateApplication()
|
package/src/tcpclient/app2.ts
CHANGED
|
@@ -48,9 +48,9 @@ socket2.on('secureConnect', () => {
|
|
|
48
48
|
dosomework(socket2);
|
|
49
49
|
});
|
|
50
50
|
socket2.on('close', function(data: any) {
|
|
51
|
-
console.log(`CLOSED: ${socket2.remoteAddress} ${socket2.remotePort}
|
|
51
|
+
console.log(chalk.green(`CLOSED: ${socket2.remoteAddress} ${socket2.remotePort}`));
|
|
52
52
|
});
|
|
53
53
|
socket2.on('data', function(data: any) {
|
|
54
|
-
console.log(`DATA ${socket2.remoteAddress} ${socket2.remotePort} ${data}
|
|
54
|
+
console.log(chalk.green(`DATA ${socket2.remoteAddress} ${socket2.remotePort} ${data}`));
|
|
55
55
|
});
|
|
56
56
|
*/
|
|
@@ -9,6 +9,8 @@ import { JSONObject } from '@nsshunt/stsutils';
|
|
|
9
9
|
import { MasterProcessBase } from './../masterprocessbase'
|
|
10
10
|
import { ProcessOptions } from './../processoptions'
|
|
11
11
|
|
|
12
|
+
import chalk from 'chalk';
|
|
13
|
+
|
|
12
14
|
// Colour codes
|
|
13
15
|
// ---------------------------------
|
|
14
16
|
// Red - Error
|
|
@@ -122,7 +124,7 @@ export class AppMaster extends MasterProcessBase
|
|
|
122
124
|
// Update my currentTerm
|
|
123
125
|
this.#currentTerm = term;
|
|
124
126
|
// Return my yes vote
|
|
125
|
-
console.log(`${message} - Vote Yes
|
|
127
|
+
console.log(chalk.green(`${message} - Vote Yes`));
|
|
126
128
|
callback(null, true); // YES vote
|
|
127
129
|
}
|
|
128
130
|
|
|
@@ -130,7 +132,7 @@ export class AppMaster extends MasterProcessBase
|
|
|
130
132
|
// Log the fact that I have now voted for this currentTerm
|
|
131
133
|
this.#votedLog[term] = true;
|
|
132
134
|
// Return my yes vote
|
|
133
|
-
console.log(`${message} - Vote No
|
|
135
|
+
console.log(chalk.yellow(`${message} - Vote No`));
|
|
134
136
|
callback(null, false); // NO vote
|
|
135
137
|
}
|
|
136
138
|
|
|
@@ -229,19 +231,19 @@ export class AppMaster extends MasterProcessBase
|
|
|
229
231
|
const retVal = this.#CheckMoreRecentTerm(term, lastLogItemTerm, lastLogItemIndex);
|
|
230
232
|
if (retVal.retVal === true) {
|
|
231
233
|
console.log(`${retVal.msg}`);
|
|
232
|
-
console.log(`${this.#GetLogPrefix()}: New leader detected, Host: [${host}], Port: [${port}], while in CANDIDATE mode, reverting to FOLLOWER
|
|
234
|
+
console.log(chalk.magenta(`${this.#GetLogPrefix()}: New leader detected, Host: [${host}], Port: [${port}], while in CANDIDATE mode, reverting to FOLLOWER.`));
|
|
233
235
|
// This sending node is the leader so revert to follower
|
|
234
236
|
this.#currentTerm = term;
|
|
235
237
|
this.#ChangeState(AppMasterRAFTState.FOLLOWER);
|
|
236
238
|
} else {
|
|
237
239
|
console.log(`${retVal.msg}`);
|
|
238
|
-
console.log(`${this.#GetLogPrefix()}: appendEntry called but log is older than my current state, Host: [${host}], Port: [${port}]
|
|
240
|
+
console.log(chalk.magenta(`${this.#GetLogPrefix()}: appendEntry called but log is older than my current state, Host: [${host}], Port: [${port}].`));
|
|
239
241
|
// Reject this RPC and continue in the CANDIDATE state
|
|
240
242
|
callback(null, false);
|
|
241
243
|
return;
|
|
242
244
|
}
|
|
243
245
|
} else if (this.#RAFTState.localeCompare(AppMasterRAFTState.LEADER) === 0) {
|
|
244
|
-
console.log(`${this.#GetLogPrefix()}: appendEntry called while I am the current leader, rejecting RPC call
|
|
246
|
+
console.log(chalk.red(`${this.#GetLogPrefix()}: appendEntry called while I am the current leader, rejecting RPC call.`));
|
|
245
247
|
// Reject this RPC and continue in the LEADER state
|
|
246
248
|
callback(null, false);
|
|
247
249
|
return;
|
|
@@ -258,7 +260,7 @@ export class AppMaster extends MasterProcessBase
|
|
|
258
260
|
}
|
|
259
261
|
} else {
|
|
260
262
|
console.log(`${retVal.msg}`);
|
|
261
|
-
console.log(`${this.#GetLogPrefix()}: appendEntry called but log is older than my current state, Host: [${host}], Port: [${port}]
|
|
263
|
+
console.log(chalk.magenta(`${this.#GetLogPrefix()}: appendEntry called but log is older than my current state, Host: [${host}], Port: [${port}].`));
|
|
262
264
|
// Reject this RPC and continue in the CANDIDATE state
|
|
263
265
|
callback(null, false);
|
|
264
266
|
return;
|
|
@@ -270,13 +272,13 @@ export class AppMaster extends MasterProcessBase
|
|
|
270
272
|
if (sentLeaderService) {
|
|
271
273
|
if (sentLeaderService.host.localeCompare(this.#leaderNode.host) !== 0 || sentLeaderService.port !== this.#leaderNode.port) {
|
|
272
274
|
this.#leaderNode = sentLeaderService;
|
|
273
|
-
console.log(`${this.#GetLogPrefix()}: Leader Service: Host:[${this.#leaderNode.host}] Port: [${this.#leaderNode.port}]
|
|
275
|
+
console.log(chalk.white(`${this.#GetLogPrefix()}: Leader Service: Host:[${this.#leaderNode.host}] Port: [${this.#leaderNode.port}]`));
|
|
274
276
|
}
|
|
275
277
|
}
|
|
276
278
|
} else {
|
|
277
279
|
this.#leaderNode = this.#FindService(host, port);
|
|
278
280
|
if (this.#leaderNode) {
|
|
279
|
-
console.log(`${this.#GetLogPrefix()}: Leader Service: Host:[${this.#leaderNode.host}] Port: [${this.#leaderNode.port}]
|
|
281
|
+
console.log(chalk.white(`${this.#GetLogPrefix()}: Leader Service: Host:[${this.#leaderNode.host}] Port: [${this.#leaderNode.port}]`));
|
|
280
282
|
}
|
|
281
283
|
}
|
|
282
284
|
|
|
@@ -309,18 +311,6 @@ export class AppMaster extends MasterProcessBase
|
|
|
309
311
|
};
|
|
310
312
|
|
|
311
313
|
const client = jayson.client.tls(options);
|
|
312
|
-
/*
|
|
313
|
-
client.on('tcp socket', (socket: tls.TLSSocket) => {
|
|
314
|
-
socket.setTimeout(200); //@@ config
|
|
315
|
-
socket.on('timeout', () => {
|
|
316
|
-
console.log('socket timeout');
|
|
317
|
-
socket.end();
|
|
318
|
-
});
|
|
319
|
-
});
|
|
320
|
-
client.on('tcp error', (error: any) => {
|
|
321
|
-
console.log(`ERROR: [${error}]`.red);
|
|
322
|
-
});
|
|
323
|
-
*/
|
|
324
314
|
|
|
325
315
|
let lastLogItem: ILogItem;
|
|
326
316
|
if (this.#log.length > 0) {
|
|
@@ -335,7 +325,7 @@ export class AppMaster extends MasterProcessBase
|
|
|
335
325
|
|
|
336
326
|
client.request('vote', [ this.#currentTerm, lastLogItem.term, lastLogItem.index ], (error: any, response: any) => {
|
|
337
327
|
if (error) {
|
|
338
|
-
//console.log(`vote attempt fail: [${JSON.stringify(options)}: ${error}]
|
|
328
|
+
//console.log(chalk.red(`vote attempt fail: [${JSON.stringify(options)}: ${error}]`));
|
|
339
329
|
} else {
|
|
340
330
|
// Log the result
|
|
341
331
|
if (response.result === true) {
|
|
@@ -353,18 +343,6 @@ export class AppMaster extends MasterProcessBase
|
|
|
353
343
|
};
|
|
354
344
|
|
|
355
345
|
const client = jayson.client.tls(options);
|
|
356
|
-
/*
|
|
357
|
-
client.on('tcp socket', (socket: tls.TLSSocket) => {
|
|
358
|
-
socket.setTimeout(200); //@@ config
|
|
359
|
-
socket.on('timeout', () => {
|
|
360
|
-
console.log('socket timeout');
|
|
361
|
-
socket.end();
|
|
362
|
-
});
|
|
363
|
-
});
|
|
364
|
-
client.on('tcp error', (error: any) => {
|
|
365
|
-
console.log(`ERROR: [${error}]`.red);
|
|
366
|
-
});
|
|
367
|
-
*/
|
|
368
346
|
|
|
369
347
|
let lastLogItem: ILogItem;
|
|
370
348
|
if (this.#log.length > 0) {
|
|
@@ -379,7 +357,7 @@ export class AppMaster extends MasterProcessBase
|
|
|
379
357
|
|
|
380
358
|
client.request('appendEntry', [ this.#thisService.host, this.#thisService.port, this.#currentTerm, lastLogItem.term, lastLogItem.index ], (error: any, response: any) => {
|
|
381
359
|
if (error) {
|
|
382
|
-
//console.log(`appendEntry attempt fail: [${JSON.stringify(options)}: ${error}]
|
|
360
|
+
//console.log(chalk.red(`appendEntry attempt fail: [${JSON.stringify(options)}: ${error}]`));
|
|
383
361
|
} else {
|
|
384
362
|
this.#appendedEntries[this.#GetServiceKey(service)] = 1;
|
|
385
363
|
// Log the result
|
|
@@ -431,14 +409,14 @@ export class AppMaster extends MasterProcessBase
|
|
|
431
409
|
if (majority) {
|
|
432
410
|
this.#StartAppendEntries();
|
|
433
411
|
} else {
|
|
434
|
-
console.log(`${this.#GetLogPrefix()}: Not enough response for valid cluster state
|
|
412
|
+
console.log(chalk.red(`${this.#GetLogPrefix()}: Not enough response for valid cluster state.`));
|
|
435
413
|
}
|
|
436
414
|
}, this.#heartBeatTimeout);
|
|
437
415
|
}
|
|
438
416
|
|
|
439
417
|
#Promote = () => {
|
|
440
418
|
this.#ChangeState(AppMasterRAFTState.LEADER);
|
|
441
|
-
console.log(`${this.#GetLogPrefix()}: New LEADER is elected: [${this.#GetSelfServiceKey()}]
|
|
419
|
+
console.log(chalk.green(`${this.#GetLogPrefix()}: New LEADER is elected: [${this.#GetSelfServiceKey()}]`));
|
|
442
420
|
// As leader, now start the regular pings
|
|
443
421
|
this.#StartAppendEntries();
|
|
444
422
|
}
|
|
@@ -492,7 +470,7 @@ export class AppMaster extends MasterProcessBase
|
|
|
492
470
|
// Log the result - Vote for myself
|
|
493
471
|
this.#votes[this.#GetSelfServiceKey()] = 1;
|
|
494
472
|
// Return my yes vote
|
|
495
|
-
console.log(`${this.#GetLogPrefix()}: SELF VOTE: canidate currentTerm: [${this.#currentTerm}], vote YES
|
|
473
|
+
console.log(chalk.green(`${this.#GetLogPrefix()}: SELF VOTE: canidate currentTerm: [${this.#currentTerm}], vote YES`));
|
|
496
474
|
this.#CheckMajority();
|
|
497
475
|
} else {
|
|
498
476
|
// Send vote request
|
|
@@ -526,13 +504,13 @@ export class AppMaster extends MasterProcessBase
|
|
|
526
504
|
}
|
|
527
505
|
|
|
528
506
|
#StartRAFTService = async () => {
|
|
529
|
-
this.LogEx(`---[ RAFT Protocol Starting ]
|
|
507
|
+
this.LogEx(chalk.green(`---[ RAFT Protocol Starting ]---`));
|
|
530
508
|
this.#server = await this.#SetupJSONRPCServer();
|
|
531
509
|
this.#StartElectionTimeout();
|
|
532
510
|
}
|
|
533
511
|
|
|
534
512
|
#ChangeState(newState: AppMasterRAFTState) {
|
|
535
|
-
this.LogEx(`${this.#GetLogPrefix()}: State Change, From: [${this.#RAFTState.toString()}] --> To: [${newState.toString()}]
|
|
513
|
+
this.LogEx(chalk.magenta(`${this.#GetLogPrefix()}: State Change, From: [${this.#RAFTState.toString()}] --> To: [${newState.toString()}]`));
|
|
536
514
|
this.#RAFTState = newState;
|
|
537
515
|
}
|
|
538
516
|
|