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 account history events being lost because of buffer overflow #5476

Merged
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 @@ -15,7 +15,8 @@ class DispatchingHandler<T : Any>(looper: Looper, private val extractor: (Messag
private val handlers = HashMap<KClass<out T>, (T) -> Unit>()
private val lock = ReentrantReadWriteLock()

private val _parsedMessages = MutableSharedFlow<T>(extraBufferCapacity = 1)
private val _parsedMessages =
MutableSharedFlow<T>(extraBufferCapacity = MESSAGES_BUFFER_CAPACITY)
val parsedMessages = _parsedMessages.asSharedFlow()

@Deprecated("Use parsedMessages instead.")
Expand Down Expand Up @@ -45,4 +46,8 @@ class DispatchingHandler<T : Any>(looper: Looper, private val extractor: (Messag

removeCallbacksAndMessages(null)
}

companion object {
private const val MESSAGES_BUFFER_CAPACITY = 10
}
}
Loading