only save settings in SettingsSyncBridge.initialize if push to server selected (related to IJPL-13931 Ensure settings categories are respected in the initial sync)

GitOrigin-RevId: 62a3abd7403417015d89389af737c170fec78d35
This commit is contained in:
Sergey Pak
2024-07-12 14:43:45 +00:00
committed by intellij-monorepo-bot
parent 98ce361a93
commit ef81135992
2 changed files with 5 additions and 4 deletions
@@ -4,6 +4,7 @@ import com.intellij.codeInsight.template.impl.TemplateSettings
import com.intellij.configurationStore.saveSettings
import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.diagnostic.logger
import com.intellij.openapi.progress.runBlockingCancellable
import com.intellij.platform.util.progress.withProgressText
import com.intellij.settingsSync.SettingsSyncBridge.PushRequestMode.*
import com.intellij.settingsSync.statistics.SettingsSyncEventsStatistics
@@ -92,9 +93,9 @@ class SettingsSyncBridge(
coroutineScope.launch {
withProgressText(SettingsSyncBundle.message(initMode.messageKey)) {
try {
// Always explicitly flush settings – if this is not done before sending sync events, then remotely synced settings
// might not contain the most up–to–date settings state (e.g. sync settings will be stale).
saveIdeSettings()
if (initMode == InitMode.PushToServer) {
saveIdeSettings()
}
settingsLog.initialize()
// the queue is not activated initially => events will be collected but not processed until we perform all initialization tasks
@@ -76,7 +76,7 @@ private class SettingsSynchronizerApplicationInitializedListener : ApplicationIn
}
private suspend fun initializeSyncing(initMode: SettingsSyncBridge.InitMode, settingsSyncEventListener: SettingsSyncEventListener) {
LOG.info("Initializing settings sync")
LOG.info("Initializing settings sync. Mode: $initMode")
val settingsSyncMain = serviceAsync<SettingsSyncMain>()
blockingContext {
settingsSyncMain.controls.bridge.initialize(initMode)