Refactor center

This commit is contained in:
2023-12-04 10:17:14 +01:00
parent 927ac2edc9
commit 06c7f42bf4

View File

@@ -28,7 +28,6 @@ if (options.help) {
process.exit(0);
}
verifyDefaults(options, centerOptions);
verifyExists(options.port, "Port can not be undefined or empty! (--port)", logger);
verifyExists(options.systemid, "SystemID can not be undefined or empty! (--systemid)", logger);
@@ -63,15 +62,17 @@ function startInterval(session, sessionLogger, rxMetrics) {
short_message: options.message,
});
sendPdu(session, pdu).then(resp => {
inFlight--;
sessionLogger.info(`Received response with id ${resp.message_id}`);
success++;
}).catch(resp => {
inFlight--;
sessionLogger.warn(`Message failed with id ${resp.message_id}`);
failed++;
});
sendPdu(session, pdu, sessionLogger, options.longsms)
.then((resp) => {
inFlight--;
sessionLogger.info(`Received response with id ${resp.message_id}`);
success++;
})
.catch((resp) => {
inFlight--;
sessionLogger.warn(`Message failed with id ${resp.message_id}`);
failed++;
});
rxMetrics.AddEvent();
sent++;