mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 16:28:12 -07:00
added time check
This commit is contained in:
parent
789918a7ab
commit
ac968cef99
1 changed files with 5 additions and 0 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue