mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[workspace model] Get rid of creating .invalidate at invalidateCaches because caches already removed
GitOrigin-RevId: 42e29074f36c2d63567c4fe71bec619d3bf8568a
This commit is contained in:
committed by
intellij-monorepo-bot
parent
adfc0068a5
commit
750aa274c3
+2
-16
@@ -107,9 +107,8 @@ class WorkspaceModelCacheImpl(private val project: Project, parentDisposable: Di
|
||||
try {
|
||||
if (!cacheFile.exists()) return null
|
||||
|
||||
if (invalidateCachesMarkerFile.exists() && cacheFile.lastModified().toMillis() < invalidateCachesMarkerFile.lastModified() ||
|
||||
invalidateProjectCacheMarkerFile.exists() && cacheFile.lastModified().toMillis() < invalidateProjectCacheMarkerFile.lastModified()) {
|
||||
LOG.info("Skipping project model cache since '$invalidateCachesMarkerFile' is present and newer than cache file '$cacheFile'")
|
||||
if (invalidateProjectCacheMarkerFile.exists() && cacheFile.lastModified().toMillis() < invalidateProjectCacheMarkerFile.lastModified()) {
|
||||
LOG.info("Skipping project model cache since '$invalidateProjectCacheMarkerFile' is present and newer than cache file '$cacheFile'")
|
||||
FileUtil.delete(cacheFile)
|
||||
return null
|
||||
}
|
||||
@@ -189,21 +188,8 @@ class WorkspaceModelCacheImpl(private val project: Project, parentDisposable: Di
|
||||
var testCacheFile: File? = null
|
||||
|
||||
private val cachesInvalidated = AtomicBoolean(false)
|
||||
private val invalidateCachesMarkerFile = File(appSystemDir.resolve("projectModelCache").toFile(), ".invalidate")
|
||||
|
||||
fun invalidateCaches() {
|
||||
LOG.info("Invalidating caches by creating $invalidateCachesMarkerFile")
|
||||
|
||||
cachesInvalidated.set(true)
|
||||
|
||||
try {
|
||||
FileUtil.createParentDirs(invalidateCachesMarkerFile)
|
||||
FileUtil.writeToFile(invalidateCachesMarkerFile, System.currentTimeMillis().toString())
|
||||
}
|
||||
catch (t: Throwable) {
|
||||
LOG.warn("Cannot update the invalidation marker file", t)
|
||||
}
|
||||
|
||||
ApplicationManager.getApplication().executeOnPooledThread {
|
||||
clearCachesForAllProjects(DATA_DIR_NAME)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user