Clear webFrame cache at a certain interval
mattermost-webapp is SPA. So cache is not cleared due to no navigation. We needed to manually clear cache to free memory in long-term-use.
This commit is contained in:
@@ -7,6 +7,7 @@ const webFrame = electron.webFrame;
|
|||||||
const EnhancedNotification = require('../js/notification');
|
const EnhancedNotification = require('../js/notification');
|
||||||
|
|
||||||
const UNREAD_COUNT_INTERVAL = 1000;
|
const UNREAD_COUNT_INTERVAL = 1000;
|
||||||
|
const CLEAR_CACHE_INTERVAL = 60 * 60 * 1000; // 1 hour
|
||||||
|
|
||||||
Notification = EnhancedNotification; // eslint-disable-line no-global-assign, no-native-reassign
|
Notification = EnhancedNotification; // eslint-disable-line no-global-assign, no-native-reassign
|
||||||
|
|
||||||
@@ -185,3 +186,10 @@ function setSpellChecker() {
|
|||||||
}
|
}
|
||||||
setSpellChecker();
|
setSpellChecker();
|
||||||
ipc.on('set-spellcheker', setSpellChecker);
|
ipc.on('set-spellcheker', setSpellChecker);
|
||||||
|
|
||||||
|
// mattermost-webapp is SPA. So cache is not cleared due to no navigation.
|
||||||
|
// We needed to manually clear cache to free memory in long-term-use.
|
||||||
|
// http://seenaburns.com/debugging-electron-memory-usage/
|
||||||
|
setInterval(() => {
|
||||||
|
webFrame.clearCache();
|
||||||
|
}, CLEAR_CACHE_INTERVAL);
|
||||||
|
Reference in New Issue
Block a user