Skip to content

Commit

Permalink
refactor(engine): use machine information module
Browse files Browse the repository at this point in the history
  • Loading branch information
FelipeTrost committed Nov 18, 2024
1 parent 2814a04 commit 885e09d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
6 changes: 3 additions & 3 deletions src/engine/universal/core/src/messaging-setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ module.exports = {
}
}
},
async setupMonitoringAndLogging(messaging, configModule, machineModule, logger, network) {
async setupMonitoringAndLogging(messaging, configModule, machineModule, logger) {
let { serverAddress, baseTopic } = await configModule.readConfig('messaging');
if (!serverAddress) return;

Expand All @@ -74,8 +74,8 @@ module.exports = {

setInterval(async () => {
try {
const monitoring = await network.loopback('get', '/machine/');
await messaging.publish(`${baseTopic}/engine/${machineId}/machine/monitoring`, monitoring);
const machineData = await machineModule.getMachineInformation();
await messaging.publish(`${baseTopic}/engine/${machineId}/machine/monitoring`, machineData);
} catch (e) {
logger.error('Failed to publish monitoring data');
}
Expand Down
8 changes: 1 addition & 7 deletions src/engine/universal/core/src/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,7 @@ module.exports = {

if (enableMessaging) {
await setupMessaging(system.messaging, config, machineInformation, logger);
await setupMonitoringAndLogging(
system.messaging,
config,
machineInformation,
logger,
system.network,
);
await setupMonitoringAndLogging(system.messaging, config, machineInformation, logger);
}

if (!options.silentMode) {
Expand Down

0 comments on commit 885e09d

Please sign in to comment.