Fix too frequent check for compiler modification

This commit is contained in:
Nikolay Krasko
2016-04-03 21:19:46 +03:00
committed by Nikolay Krasko
parent b55610b1f0
commit 473a05b456
@@ -64,7 +64,7 @@ class LazyClasspathWatcher(classpath: Iterable<String>,
.flatMap { it.walk().filter(::isClasspathFile) }
.map { FileId(it, it.lastModified(), it.md5Digest()) }
.toList()
val nowMs = TimeUnit.MILLISECONDS.toMillis(System.nanoTime())
val nowMs = TimeUnit.NANOSECONDS.toMillis(System.nanoTime())
lastUpdate.set(nowMs)
lastDigestUpdate.set(nowMs)
}
@@ -80,7 +80,7 @@ class LazyClasspathWatcher(classpath: Iterable<String>,
val isChanged: Boolean get() {
if (lastChangedStatus.get()) return true
val nowMs = TimeUnit.MILLISECONDS.toMillis(System.nanoTime())
val nowMs = TimeUnit.NANOSECONDS.toMillis(System.nanoTime())
if (nowMs - lastUpdate.get() < checkPeriod) return false
val checkDigest = nowMs - lastDigestUpdate.get() > digestCheckPeriod
@@ -106,7 +106,7 @@ class LazyClasspathWatcher(classpath: Iterable<String>,
true // io error considered as change
}
} != null
lastUpdate.set(TimeUnit.MILLISECONDS.toMillis(System.nanoTime()))
lastUpdate.set(TimeUnit.NANOSECONDS.toMillis(System.nanoTime()))
if (checkDigest) lastDigestUpdate.set(lastUpdate.get())
return changed