Skip to content

Commit 9bfa3bb

Browse files
authored
Merge pull request #2276 from murataslan1/fix/cache-autoupdate-check
Cache autoupdate check to run only once per 24 hours
2 parents 5986014 + a7eb97c commit 9bfa3bb

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

src/main/electron.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1283,8 +1283,20 @@ app.whenReady().then(() =>
12831283
owner: 'jgraph'
12841284
})
12851285

1286-
if (store == null || (!disableUpdate && !store.get('dontCheckUpdates')))
1286+
// Cache update check - configurable interval (default: 24 hours)
1287+
const DEFAULT_UPDATE_CHECK_HOURS = 24;
1288+
const updateCheckHours = store?.get('updateCheckIntervalHours') ?? DEFAULT_UPDATE_CHECK_HOURS;
1289+
const UPDATE_CHECK_INTERVAL = updateCheckHours * 60 * 60 * 1000;
1290+
const lastUpdateCheck = store?.get('lastUpdateCheck') || 0;
1291+
const shouldCheckUpdates = Date.now() - lastUpdateCheck > UPDATE_CHECK_INTERVAL;
1292+
1293+
if (store == null || (!disableUpdate && !store.get('dontCheckUpdates') && shouldCheckUpdates))
12871294
{
1295+
if (store != null)
1296+
{
1297+
store.set('lastUpdateCheck', Date.now());
1298+
}
1299+
12881300
autoUpdater.checkForUpdates()
12891301
}
12901302
})

0 commit comments

Comments
 (0)