Electron-136 (Optimize memory by reloading the app when the user is idle) (#335)

- Refresh app when memory exceeds the threshold and if user is inactive
- Add logic to reload app when memory exceeds threshold and if user is inactive
- Add reload threshold
- Fix unit test
This commit is contained in:
Kiran Niranjan
2018-04-11 13:06:46 +00:00
committed by Vishwas Shashidhar
parent 2e25c97bec
commit 2de86c8003
9 changed files with 111 additions and 4 deletions

View File

@@ -17,6 +17,7 @@ const { bringToFront } = require('./bringToFront.js');
const eventEmitter = require('./eventEmitter');
const { isMac } = require('./utils/misc');
const { openScreenPickerWindow } = require('./desktopCapturer');
const { optimizeMemory } = require('./memoryMonitor');
const apiEnums = require('./enums/api.js');
const apiCmds = apiEnums.cmds;
@@ -147,6 +148,11 @@ electron.ipcMain.on(apiName, (event, arg) => {
windowMgr.getMenu().popup(browserWin, { x: 20, y: 15, async: true });
}
break;
case apiCmds.optimizeMemoryConsumption:
if (typeof arg.memory === 'object' && typeof arg.memory.workingSetSize === 'number') {
optimizeMemory(arg.memory);
}
break;
default:
}