diff --git a/src/main/electron.js b/src/main/electron.js index 97696b63e..a652532da 100644 --- a/src/main/electron.js +++ b/src/main/electron.js @@ -1171,8 +1171,20 @@ app.whenReady().then(() => owner: 'jgraph' }) - if (store == null || (!disableUpdate && !store.get('dontCheckUpdates'))) + // Cache update check - configurable interval (default: 24 hours) + const DEFAULT_UPDATE_CHECK_HOURS = 24; + const updateCheckHours = store?.get('updateCheckIntervalHours') ?? DEFAULT_UPDATE_CHECK_HOURS; + const UPDATE_CHECK_INTERVAL = updateCheckHours * 60 * 60 * 1000; + const lastUpdateCheck = store?.get('lastUpdateCheck') || 0; + const shouldCheckUpdates = Date.now() - lastUpdateCheck > UPDATE_CHECK_INTERVAL; + + if (store == null || (!disableUpdate && !store.get('dontCheckUpdates') && shouldCheckUpdates)) { + if (store != null) + { + store.set('lastUpdateCheck', Date.now()); + } + autoUpdater.checkForUpdates() } })