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

Updated Kotlin and the libs for coroutines #200

Merged
merged 14 commits into from Jan 30, 2022

Conversation

greggiacovelli
Copy link
Contributor

@greggiacovelli greggiacovelli commented Dec 18, 2021

Adds coroutine 1.6.0 support to scarlet

  • coroutines-reactive no longer allows for Publisher.openSubscription(): ReceiveChannel
  • Implemented a hot flow via the 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 previous openSubscription() usage
  • implemented FlowStreamAdapter to allow for interfaces which return flow rather than channels, fun observeEvents(): Flow<Event>
  • Should fix/close:

* Updated scarlet-stream-adapter-coroutines to be compatible with 1.5.30 as well regarding use of asFlow and channels
@greggiacovelli greggiacovelli force-pushed the update-kotlin branch 2 times, most recently from 5ee26f6 to d1234ce Compare December 22, 2021 22:31
@greggiacovelli greggiacovelli marked this pull request as ready for review December 22, 2021 22:36
any<WebSocket.Event.OnMessageReceived>().containingBytes(bytesMessage2)
)

assertThat(testTextChannel.take(2).toList()).containsExactly(
Copy link
Contributor

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?

Copy link
Contributor Author

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

@aaronweihe aaronweihe merged commit 72dcb2a into Tinder:main Jan 30, 2022
@aaronweihe
Copy link
Collaborator

thanks! @greggiacovelli

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants