Skip to content

Commit 77ec2ef

Browse files
authored
fix-CycleInitializationException
fix-CycleInitializationException
2 parents 5f89495 + 7eeb6b9 commit 77ec2ef

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

ide-common/src/main/java/org/digma/intellij/plugin/analytics/AnalyticsService.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,6 @@ synchronized void replaceClient(String url) {
129129

130130
environment.refreshNowOnBackground();
131131

132-
BackendInfoHolder.getInstance().updateInBackground();
133-
134132
ApplicationManager.getApplication().getMessageBus().syncPublisher(ApiClientChangedEvent.getAPI_CLIENT_CHANGED_TOPIC()).apiClientChanged(url);
135133

136134
}

ide-common/src/main/kotlin/org/digma/intellij/plugin/analytics/BackendInfoHolder.kt

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
package org.digma.intellij.plugin.analytics
22

3+
import com.intellij.collaboration.async.disposingScope
34
import com.intellij.openapi.Disposable
45
import com.intellij.openapi.application.ApplicationManager
56
import com.intellij.openapi.components.Service
67
import com.intellij.openapi.components.service
78
import com.intellij.openapi.diagnostic.Logger
89
import com.intellij.openapi.project.Project
10+
import kotlinx.coroutines.launch
911
import org.digma.intellij.plugin.common.Backgroundable
1012
import org.digma.intellij.plugin.common.ExceptionUtils
1113
import org.digma.intellij.plugin.common.findActiveProject
@@ -51,6 +53,12 @@ class BackendInfoHolder : Disposable {
5153
updateInBackground()
5254
}
5355
})
56+
57+
ApplicationManager.getApplication().messageBus.connect(this)
58+
.subscribe(ApiClientChangedEvent.API_CLIENT_CHANGED_TOPIC, ApiClientChangedEvent {
59+
Log.log(logger::debug, "got apiClientChanged")
60+
updateInBackground()
61+
})
5462
}
5563

5664

@@ -60,13 +68,15 @@ class BackendInfoHolder : Disposable {
6068

6169
//updateInBackground is also called every time the analytics client is replaced
6270
fun updateInBackground() {
63-
Backgroundable.ensurePooledThreadWithoutReadAccess {
71+
@Suppress("UnstableApiUsage")
72+
disposingScope().launch {
6473
findActiveProject()?.let {
6574
aboutRef.set(AnalyticsService.getInstance(it).about)
6675
}
6776
}
6877
}
6978

79+
7080
fun isCentralized(): Boolean {
7181
return aboutRef.get()?.let {
7282
it.isCentralize ?: false

0 commit comments

Comments
 (0)