1
0
Fork 0
mirror of https://github.com/ethauvin/kobalt.git synced 2025-04-27 08:38:13 -07:00

added time check

This commit is contained in:
voddan 2016-01-29 12:48:38 +03:00
parent 789918a7ab
commit ac968cef99

View file

@ -4,6 +4,7 @@ import com.beust.kobalt.api.Kobalt
import com.beust.kobalt.misc.*
import com.beust.kobalt.wrapper.Main
import java.io.File
import java.time.Duration
import java.time.Instant
import java.util.concurrent.TimeoutException
import javax.inject.Inject
@ -26,6 +27,10 @@ public class UpdateKobalt @Inject constructor(val github: GithubApi, val wrapper
}
fun checkForNewVersion(latestVersionString: String) {
if(Kobalt.versionCheckTimeout
> Duration.between(wrapperProperties.versionLastChecked, Instant.now()))
return // waits `Kobalt.versionCheckTimeout` before the next check
try {
val latestVersion = Versions.toLongVersion(latestVersionString)
val current = Versions.toLongVersion(Kobalt.version)