(force = false)
| 279 | * @param force - Skip the minimum interval check |
| 280 | */ |
| 281 | export async function checkForUpdates(force = false) { |
| 282 | if (!app.isPackaged) { |
| 283 | log.info("[AutoUpdater] Skipping update check in dev mode") |
| 284 | return Promise.resolve(null) |
| 285 | } |
| 286 | |
| 287 | // Respect minimum interval to prevent spam |
| 288 | const now = Date.now() |
| 289 | if (!force && now - lastCheckTime < MIN_CHECK_INTERVAL) { |
| 290 | log.info( |
| 291 | `[AutoUpdater] Skipping check - last check was ${Math.round((now - lastCheckTime) / 1000)}s ago`, |
| 292 | ) |
| 293 | return Promise.resolve(null) |
| 294 | } |
| 295 | |
| 296 | lastCheckTime = now |
| 297 | return autoUpdater.checkForUpdates() |
| 298 | } |
| 299 | |
| 300 | /** |
| 301 | * Start downloading the update |
no test coverage detected