From 762718eb482f52b2d42e4015edfe3c37469b26d5 Mon Sep 17 00:00:00 2001 From: Nikita Katkov Date: Mon, 17 Feb 2025 13:23:34 +0100 Subject: [PATCH] [recent files] IJPL-178295 Increase the buffer size to avoid loosing recent files The limit in the previous implementation affected only the case when there are more than SWITCHER_ELEMENTS_LIMIT opened editor tabs. Files fetched from the editor history or changed files history were not affected by the limit, and this must stay the same in the new implementation This is a fast fix, but proper fix is going to be delivered soon. It will group files into batches and deliver them altogether -> there will be no partial data losses. Instead, we will be able to drop old requested data and always display only the freshest batch of files which would be consistent with the fallback monolith implementation GitOrigin-RevId: 70ae325ba6859707319eeb18f6158279304bb640 --- .../recentFiles/backend/RecentFileEventsPerProjectHolder.kt | 2 +- .../platform/recentFiles/backend/recentFilesCollector.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/platform/recentFiles/backend/src/com/intellij/platform/recentFiles/backend/RecentFileEventsPerProjectHolder.kt b/platform/recentFiles/backend/src/com/intellij/platform/recentFiles/backend/RecentFileEventsPerProjectHolder.kt index be71a02ed747..463b2c51c962 100644 --- a/platform/recentFiles/backend/src/com/intellij/platform/recentFiles/backend/RecentFileEventsPerProjectHolder.kt +++ b/platform/recentFiles/backend/src/com/intellij/platform/recentFiles/backend/RecentFileEventsPerProjectHolder.kt @@ -21,7 +21,7 @@ import kotlinx.coroutines.flow.* @Service(Service.Level.PROJECT) internal class RecentFileEventsPerProjectHolder { private val recentFiles = MutableSharedFlow( - extraBufferCapacity = SWITCHER_ELEMENTS_LIMIT, + extraBufferCapacity = 100, onBufferOverflow = BufferOverflow.DROP_OLDEST ) diff --git a/platform/recentFiles/backend/src/com/intellij/platform/recentFiles/backend/recentFilesCollector.kt b/platform/recentFiles/backend/src/com/intellij/platform/recentFiles/backend/recentFilesCollector.kt index 9de26fed32a3..ad6582ebeac4 100644 --- a/platform/recentFiles/backend/src/com/intellij/platform/recentFiles/backend/recentFilesCollector.kt +++ b/platform/recentFiles/backend/src/com/intellij/platform/recentFiles/backend/recentFilesCollector.kt @@ -143,4 +143,4 @@ private fun createRecentFileViewModel(virtualFile: VirtualFile, project: Project ) } -internal const val SWITCHER_ELEMENTS_LIMIT: Int = 30 \ No newline at end of file +private const val SWITCHER_ELEMENTS_LIMIT: Int = 30 \ No newline at end of file