From af5eb04e4b2cc50310ba5bf22d62d239a10e01c2 Mon Sep 17 00:00:00 2001 From: Cedric Beust Date: Thu, 30 Mar 2017 12:03:48 -0700 Subject: [PATCH] Force update if autoUpdate is true. --- src/main/kotlin/com/beust/kobalt/app/UpdateKobalt.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/com/beust/kobalt/app/UpdateKobalt.kt b/src/main/kotlin/com/beust/kobalt/app/UpdateKobalt.kt index 3b74e15b..ca9548ea 100644 --- a/src/main/kotlin/com/beust/kobalt/app/UpdateKobalt.kt +++ b/src/main/kotlin/com/beust/kobalt/app/UpdateKobalt.kt @@ -35,7 +35,9 @@ class UpdateKobalt @Inject constructor(val github: GithubApi2, val wrapperProper * Accepts Future as `latestVersionFuture` to allow getting `latestVersion` in the background. */ fun checkForNewVersion(latestVersionFuture: Future) { - if (Kobalt.versionCheckTimeout > Duration.between(VersionCheckTimestampFile.timestamp, Instant.now())) { + // Only check once a day, except if autoUpdate is true + if (Kobalt.versionCheckTimeout > Duration.between(VersionCheckTimestampFile.timestamp, Instant.now()) + && ! settings.autoUpdate) { return // waits `Kobalt.versionCheckTimeout` before the next check }