File tree Expand file tree Collapse file tree 2 files changed +30
-1
lines changed
ide-common/src/main/kotlin/org/digma/intellij/plugin/analytics
src/main/kotlin/org/digma/intellij/plugin/ui/common Expand file tree Collapse file tree 2 files changed +30
-1
lines changed Original file line number Diff line number Diff line change @@ -66,6 +66,16 @@ class BackendInfoHolder : Disposable {
6666 return aboutRef.get()
6767 }
6868
69+ fun getAboutLoadIfNull (): AboutResult ? {
70+ if (aboutRef.get() == null ) {
71+ findActiveProject()?.let {
72+ loadAboutInBackgroundNow(it)
73+ }
74+ }
75+ return aboutRef.get()
76+ }
77+
78+
6979 // updateInBackground is also called every time the analytics client is replaced
7080 fun updateInBackground () {
7181 @Suppress(" UnstableApiUsage" )
@@ -122,4 +132,23 @@ class BackendInfoHolder : Disposable {
122132 false
123133 }
124134 }
135+
136+ private fun loadAboutInBackgroundNow (project : Project ) {
137+
138+ try {
139+
140+ val future = Backgroundable .ensurePooledThreadWithoutReadAccess(Callable {
141+ AnalyticsService .getInstance(project).about
142+ })
143+
144+ aboutRef.set(future.get(5 , TimeUnit .SECONDS ))
145+
146+ } catch (e: Throwable ) {
147+ val isConnectionException = ExceptionUtils .isAnyConnectionException(e)
148+
149+ if (! isConnectionException) {
150+ ErrorReporter .getInstance().reportError(" BackendUtilsKt.isCentralized" , e)
151+ }
152+ }
153+ }
125154}
Original file line number Diff line number Diff line change @@ -134,7 +134,7 @@ class LoadStatusPanel(val project: Project) : DigmaResettablePanel() {
134134 private fun shouldDisplayCloseButton (): Boolean
135135 {
136136
137- val version = BackendInfoHolder .getInstance().getAbout ()?.applicationVersion ? : return false
137+ val version = BackendInfoHolder .getInstance().getAboutLoadIfNull ()?.applicationVersion ? : return false
138138
139139 val currentBackendVersion = ComparableVersion (version)
140140 val closeButtonBackendVersion = ComparableVersion (" 0.3.25" )
You can’t perform that action at this time.
0 commit comments