Skip to content

Commit 88f6db9

Browse files
sergeysozinovenotniy
authored andcommitted
MBX-3295: fixed dead lock (#450)
1 parent 4b8170a commit 88f6db9

File tree

1 file changed

+5
-3
lines changed
  • sdk/src/main/java/cloud/mindbox/mobile_sdk

1 file changed

+5
-3
lines changed

sdk/src/main/java/cloud/mindbox/mobile_sdk/Mindbox.kt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ object Mindbox : MindboxLog {
9292

9393
private val mutex = Mutex()
9494

95+
private val inAppMutex = Mutex()
96+
9597
private var firstInitCall: Boolean = true
9698

9799
/**
@@ -516,7 +518,7 @@ object Mindbox : MindboxLog {
516518
if (activity != null && lifecycleManager.isCurrentActivityResumed) {
517519
inAppMessageManager.registerCurrentActivity(activity)
518520
mindboxScope.launch {
519-
mutex.withLock {
521+
inAppMutex.withLock {
520522
firstInitCall = false
521523
inAppMessageManager.listenEventAndInApp()
522524
inAppMessageManager.initLogs()
@@ -570,8 +572,8 @@ object Mindbox : MindboxLog {
570572
)
571573
if (firstInitCall) {
572574
mindboxScope.launch {
573-
mutex.withLock {
574-
InitializeLock.await(InitializeLock.State.SAVE_MINDBOX_CONFIG)
575+
InitializeLock.await(InitializeLock.State.SAVE_MINDBOX_CONFIG)
576+
inAppMutex.withLock {
575577
if (!firstInitCall) return@launch
576578
firstInitCall = false
577579
inAppMessageManager.listenEventAndInApp()

0 commit comments

Comments
 (0)