Removed mutex from tab state
Workaround to make rebase interactive work again as it runs simultaneous operations
This commit is contained in:
parent
d93e634a5c
commit
d6a8b93026
@ -34,7 +34,7 @@ class TabState @Inject constructor(
|
||||
return git
|
||||
}
|
||||
|
||||
private val mutex = Mutex()
|
||||
// private val mutex = Mutex()
|
||||
|
||||
private val _refreshData = MutableSharedFlow<RefreshType>()
|
||||
val refreshData: Flow<RefreshType> = _refreshData
|
||||
@ -46,9 +46,6 @@ class TabState @Inject constructor(
|
||||
*/
|
||||
@set:Synchronized
|
||||
var operationRunning = false
|
||||
get() {
|
||||
return field || mutex.isLocked
|
||||
}
|
||||
|
||||
private val _processing = MutableStateFlow(false)
|
||||
val processing: StateFlow<Boolean> = _processing
|
||||
@ -60,7 +57,6 @@ class TabState @Inject constructor(
|
||||
callback: suspend (git: Git) -> Unit
|
||||
) =
|
||||
managerScope.launch(Dispatchers.IO) {
|
||||
mutex.withLock {
|
||||
var hasProcessFailed = false
|
||||
operationRunning = true
|
||||
|
||||
@ -86,12 +82,11 @@ class TabState @Inject constructor(
|
||||
if (refreshType != RefreshType.NONE && (!hasProcessFailed || refreshEvenIfCrashes))
|
||||
_refreshData.emit(refreshType)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun safeProcessingWihoutGit(showError: Boolean = true, callback: suspend CoroutineScope.() -> Unit) =
|
||||
managerScope.launch(Dispatchers.IO) {
|
||||
mutex.withLock {
|
||||
_processing.value = true
|
||||
operationRunning = true
|
||||
|
||||
@ -107,7 +102,6 @@ class TabState @Inject constructor(
|
||||
operationRunning = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun runOperation(
|
||||
showError: Boolean = false,
|
||||
@ -115,7 +109,6 @@ class TabState @Inject constructor(
|
||||
refreshEvenIfCrashes: Boolean = false,
|
||||
block: suspend (git: Git) -> Unit
|
||||
) = managerScope.launch(Dispatchers.IO) {
|
||||
mutex.withLock {
|
||||
var hasProcessFailed = false
|
||||
|
||||
operationRunning = true
|
||||
@ -146,7 +139,6 @@ class TabState @Inject constructor(
|
||||
_refreshData.emit(refreshType)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun coRunOperation(
|
||||
showError: Boolean = false,
|
||||
@ -154,7 +146,6 @@ class TabState @Inject constructor(
|
||||
refreshEvenIfCrashes: Boolean = false,
|
||||
block: suspend (git: Git) -> Unit
|
||||
) = withContext(Dispatchers.IO) {
|
||||
mutex.withLock {
|
||||
var hasProcessFailed = false
|
||||
|
||||
operationRunning = true
|
||||
@ -185,7 +176,6 @@ class TabState @Inject constructor(
|
||||
_refreshData.emit(refreshType)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun refreshData(refreshType: RefreshType) {
|
||||
_refreshData.emit(refreshType)
|
||||
|
Loading…
Reference in New Issue
Block a user