mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-03-22 15:19:59 +07:00
[collab] fix test waiting for scope to finish forever
GitOrigin-RevId: 740a2a68e92e7f2208f9890531ca9ad58a0383e1
This commit is contained in:
committed by
intellij-monorepo-bot
parent
b627df99b7
commit
e3023fe037
@@ -2,8 +2,9 @@
|
||||
package com.intellij.collaboration.auth
|
||||
|
||||
import com.intellij.concurrency.ConcurrentCollectionFactory
|
||||
import com.intellij.util.awaitCancellationAndInvoke
|
||||
import kotlinx.coroutines.CoroutineName
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Job
|
||||
import kotlinx.coroutines.flow.first
|
||||
import kotlinx.coroutines.launch
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
@@ -15,14 +16,14 @@ class AccountUrlAuthenticationFailuresHolder<A : Account>(
|
||||
private val storeMap = ConcurrentHashMap<A, MutableSet<String>>()
|
||||
|
||||
init {
|
||||
cs.awaitCancellationAndInvoke {
|
||||
cs.coroutineContext[Job]?.invokeOnCompletion {
|
||||
storeMap.clear()
|
||||
}
|
||||
}
|
||||
|
||||
fun markFailed(account: A, url: String) {
|
||||
storeMap.computeIfAbsent(account) {
|
||||
cs.launch {
|
||||
cs.launch(CoroutineName("AccountUrlAuthenticationFailuresHolder token change listener")) {
|
||||
accountManager().getCredentialsFlow(account).first()
|
||||
storeMap.remove(account)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user