Add clarification comment about thread-safety of DirtyFiles

GitOrigin-RevId: 510fb3c4cb49a1d58f660e7891229429d88a4707
This commit is contained in:
Liudmila Kornilova
2024-02-07 13:36:33 +01:00
committed by intellij-monorepo-bot
parent 936e6c4c72
commit 0a14ce2dea

View File

@@ -18,6 +18,10 @@ class DirtyFiles {
for (project in projects) {
val projectDirtyFiles = myDirtyFiles.find { it.first == project }?.second
if (projectDirtyFiles != null) {
// Technically, we can lose this file id if thread suspends here
// then the project is closed, queue is persisted, and only then thread resumes.
// To avoid this, we would need to add synchronized blocks when working with myDirtyFiles which will make file events processing slow
// So I think it's ok to risk some inconsistency
projectDirtyFiles.addFile(fileId)
addedToAtLeastOneProject = true
}