Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: wait for logout to be completed when handling user events [WPB-9689] [WPB-10310] #2914

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ internal class UserEventReceiverImpl internal constructor(
return currentClientIdProvider().map { currentClientId ->
if (currentClientId == event.clientId) {
logger.logSuccess("info" to "CURRENT_CLIENT")
logout(LogoutReason.REMOVED_CLIENT)
logout(LogoutReason.REMOVED_CLIENT, waitUntilCompletes = true)
} else {
logger.logSuccess("info" to "OTHER_CLIENT")
}
Expand All @@ -148,7 +148,7 @@ internal class UserEventReceiverImpl internal constructor(
private suspend fun handleUserDelete(event: Event.User.UserDelete): Either<CoreFailure, Unit> {
val logger = kaliumLogger.createEventProcessingLogger(event)
return if (selfUserId == event.userId) {
logout(LogoutReason.DELETED_ACCOUNT)
logout(LogoutReason.DELETED_ACCOUNT, waitUntilCompletes = true)
Either.Right(Unit)
} else {
userRepository.markUserAsDeletedAndRemoveFromGroupConversations(event.userId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class UserEventReceiverTest {
eventReceiver.onEvent(event, TestEvent.liveDeliveryInfo)

coVerify {
arrangement.logoutUseCase.invoke(eq(LogoutReason.REMOVED_CLIENT), any())
arrangement.logoutUseCase.invoke(eq(LogoutReason.REMOVED_CLIENT), eq(true))
}.wasInvoked(exactly = once)
}

Expand Down Expand Up @@ -99,7 +99,7 @@ class UserEventReceiverTest {
eventReceiver.onEvent(event, TestEvent.liveDeliveryInfo)

coVerify {
arrangement.logoutUseCase.invoke(eq(LogoutReason.DELETED_ACCOUNT), any())
arrangement.logoutUseCase.invoke(eq(LogoutReason.DELETED_ACCOUNT), eq(true))
}.wasInvoked(exactly = once)
}

Expand Down
Loading