Skip to content

Commit 7ac7413

Browse files
committed
better pause AuthManager
1 parent 282368e commit 7ac7413

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ public AnalyticsService(@NotNull Project project) {
107107
if (shouldReplaceClient) {
108108
Log.log(LOGGER::debug, "api url changed to {}, calling replace client", myApiUrl);
109109
AuthManager.getInstance().logout();
110-
AuthManager.getInstance().pauseCurrentProxy();
110+
AuthManager.getInstance().pause();
111111
replaceClient(myApiUrl);
112112
}
113113

ide-common/src/main/kotlin/org/digma/intellij/plugin/auth/AuthManager.kt

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class AuthManager {
4545
private var analyticsProvider: RestAnalyticsProvider? = null
4646

4747
private val loginOrRefreshLock = ReentrantLock()
48-
private val isProxyPaused: AtomicBoolean = AtomicBoolean(true)
48+
private val isPaused: AtomicBoolean = AtomicBoolean(true)
4949

5050
companion object {
5151
@JvmStatic
@@ -96,7 +96,7 @@ class AuthManager {
9696
)
9797

9898
Log.log(logger::info, "resuming current proxy, analytics url {}", analyticsProvider?.apiUrl)
99-
isProxyPaused.set(false)
99+
isPaused.set(false)
100100
return proxy
101101
}
102102

@@ -281,6 +281,10 @@ class AuthManager {
281281

282282
private fun fireChange() {
283283

284+
if (isPaused.get()) {
285+
return
286+
}
287+
284288
Log.log(
285289
logger::trace, "firing authInfoChanged, default account {}, analytics url {}",
286290
DigmaDefaultAccountHolder.getInstance().account,
@@ -298,10 +302,10 @@ class AuthManager {
298302
}
299303

300304

301-
fun pauseCurrentProxy() {
305+
fun pause() {
302306
Log.log(logger::info, "pausing current proxy, analytics url {}", analyticsProvider?.apiUrl)
303307
analyticsProvider = null
304-
isProxyPaused.set(true)
308+
isPaused.set(true)
305309
}
306310

307311

@@ -467,7 +471,7 @@ class AuthManager {
467471
} catch (e: InvocationTargetException) {
468472

469473
Log.debugWithException(logger, e, "Exception in proxy {}", ExceptionUtils.getNonEmptyMessage(e))
470-
if (isProxyPaused.get()) {
474+
if (isPaused.get()) {
471475
Log.log(logger::trace, "got Exception in proxy but proxy is paused, rethrowing")
472476
throw e
473477
}

0 commit comments

Comments
 (0)