-
Notifications
You must be signed in to change notification settings - Fork 240
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
Updated Kotlin and the libs for coroutines #200
Conversation
* Updated scarlet-stream-adapter-coroutines to be compatible with 1.5.30 as well regarding use of asFlow and channels
5ee26f6
to
d1234ce
Compare
36de993
to
a59de17
Compare
…hannel Fixes Tinder#169 Fixes Tinder#163 Fixes Tinder#27
…havior of the past Relied on a subscription and a buffered observer, adding buffering
a59de17
to
55bb7fc
Compare
demo/src/main/java/com/tinder/app/echo/domain/ChatMessageRepository.kt
Outdated
Show resolved
Hide resolved
...eam-adapter-coroutines/src/main/java/com/tinder/streamadapter/coroutines/ChannelForwarder.kt
Outdated
Show resolved
Hide resolved
...oroutines/src/test/java/com/tinder/scarlet/streamadapter/coroutines/FlowStreamAdapterTest.kt
Outdated
Show resolved
Hide resolved
any<WebSocket.Event.OnMessageReceived>().containingBytes(bytesMessage2) | ||
) | ||
|
||
assertThat(testTextChannel.take(2).toList()).containsExactly( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not fully follow the tests, but is this testTextChannel
caching values that it may have already received?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so the testTextChannel, (renamed to flow at this point) hasn't been read yet however since the connection is still open during this evaluation, we only want the first 2 values otherwise we would block indefinitely.
So yes in short the buffer acts like a cache
...oroutines/src/test/java/com/tinder/scarlet/streamadapter/coroutines/FlowStreamAdapterTest.kt
Outdated
Show resolved
Hide resolved
thanks! @greggiacovelli |
Adds coroutine 1.6.0 support to scarlet
Publisher.openSubscription(): ReceiveChannel
Stream.Observer
interface in order to agree with Scarlet implementation, ideally this would be a cold flow that opens to connect however since the connection state is unknown it has to be hot. This is also in agreement with the previousopenSubscription()
usageFlowStreamAdapter
to allow for interfaces which return flow rather than channels,fun observeEvents(): Flow<Event>