From 1d40eee520262bd1e48fc356b2fe8ed0cd76bffb Mon Sep 17 00:00:00 2001 From: Murat Aslan Date: Sat, 29 Nov 2025 16:56:21 +0300 Subject: [PATCH 1/2] Cache autoupdate check to run only once per 24 hours Previously, the update check ran on every application start, which was annoying when running drawio in scripts or frequently from CLI (even with --help flag). This change caches the last update check timestamp and only performs a new check if 24 hours have passed since the last one. Fixes #2262 --- src/main/electron.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/main/electron.js b/src/main/electron.js index 97696b63e..bb844155e 100644 --- a/src/main/electron.js +++ b/src/main/electron.js @@ -1171,8 +1171,18 @@ app.whenReady().then(() => owner: 'jgraph' }) - if (store == null || (!disableUpdate && !store.get('dontCheckUpdates'))) + // Cache update check - only check once per 24 hours to avoid repeated messages + const UPDATE_CHECK_INTERVAL = 24 * 60 * 60 * 1000; // 24 hours + 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() } }) From a7eb97c6a3e9a8ad2461ba4b560265088b639652 Mon Sep 17 00:00:00 2001 From: Murat Aslan Date: Wed, 3 Dec 2025 12:02:57 +0300 Subject: [PATCH 2/2] Make update check interval configurable Allow users to configure the update check interval via 'updateCheckIntervalHours' setting in electron-store. Default remains 24 hours for backward compatibility. Example: Set to 168 for weekly checks. --- src/main/electron.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/electron.js b/src/main/electron.js index bb844155e..a652532da 100644 --- a/src/main/electron.js +++ b/src/main/electron.js @@ -1171,8 +1171,10 @@ app.whenReady().then(() => owner: 'jgraph' }) - // Cache update check - only check once per 24 hours to avoid repeated messages - const UPDATE_CHECK_INTERVAL = 24 * 60 * 60 * 1000; // 24 hours + // 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;