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

avoid duplicated messages after sending #4688

Merged
merged 1 commit into from
Feb 6, 2025
Merged
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 @@ -44,7 +44,6 @@ import kotlinx.coroutines.flow.catch
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.flow.flow
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.retryWhen
import kotlinx.coroutines.isActive
import kotlinx.coroutines.launch
import java.io.IOException
Expand Down Expand Up @@ -839,14 +838,6 @@ class OfflineFirstChatRepository @Inject constructor(

emit(Result.success(chatMessageModel))
}
.retryWhen { cause, attempt ->
if (cause is IOException && attempt < SEND_MESSAGE_RETRY_ATTEMPTS) {
delay(SEND_MESSAGE_RETRY_DELAY)
return@retryWhen true
} else {
return@retryWhen false
}
}
.catch { e ->
Log.e(TAG, "Error when sending message", e)

Expand Down Expand Up @@ -1038,7 +1029,5 @@ class OfflineFirstChatRepository @Inject constructor(
private const val DELAY_TO_ENSURE_MESSAGES_ARE_ADDED: Long = 100
private const val DEFAULT_MESSAGES_LIMIT = 100
private const val MILLIES = 1000
private const val SEND_MESSAGE_RETRY_ATTEMPTS = 3
private const val SEND_MESSAGE_RETRY_DELAY: Long = 2000
}
}
Loading