mirror of
https://github.com/usebruno/bruno.git
synced 2026-07-09 06:55:03 +00:00
fix: High CPU due to WMI queries (#5924)
* fix: High CPU due to WMI queries
This commit is contained in:
35
packages/bruno-electron/src/ipc/system-monitor.js
Normal file
35
packages/bruno-electron/src/ipc/system-monitor.js
Normal file
@@ -0,0 +1,35 @@
|
||||
const { ipcMain } = require('electron');
|
||||
|
||||
const registerSystemMonitorIpc = (mainWindow, systemMonitor) => {
|
||||
ipcMain.handle('renderer:start-system-monitoring', (event, intervalMs = 2000) => {
|
||||
try {
|
||||
systemMonitor.start(mainWindow, intervalMs);
|
||||
return { success: true };
|
||||
} catch (error) {
|
||||
console.error('Error starting system monitoring:', error);
|
||||
return { success: false, error: error.message };
|
||||
}
|
||||
});
|
||||
|
||||
ipcMain.handle('renderer:stop-system-monitoring', (event) => {
|
||||
try {
|
||||
systemMonitor.stop();
|
||||
return { success: true };
|
||||
} catch (error) {
|
||||
console.error('Error stopping system monitoring:', error);
|
||||
return { success: false, error: error.message };
|
||||
}
|
||||
});
|
||||
|
||||
ipcMain.handle('renderer:is-system-monitoring-active', (event) => {
|
||||
try {
|
||||
const isActive = systemMonitor.isRunning();
|
||||
return { success: true, isActive };
|
||||
} catch (error) {
|
||||
console.error('Error checking system monitoring status:', error);
|
||||
return { success: false, error: error.message, isActive: false };
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
module.exports = registerSystemMonitorIpc;
|
||||
Reference in New Issue
Block a user