-
Notifications
You must be signed in to change notification settings - Fork 4
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
Reset online clients when stream is disconnected #181
Conversation
@@ -18,9 +18,9 @@ public class Presences private constructor( | |||
|
|||
public operator fun minus(actorID: ActorID): Presences = (map - actorID).asPresences() | |||
|
|||
override fun hashCode(): Int = map.hashCode() | |||
|
|||
override fun equals(other: Any?): Boolean = map == (other as? Presences)?.map |
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 removed it to ensure that document.publishPresenceEvent()
is properly invoked whenever a new value is emitted to document.presences
.
} | ||
val streamJob = launch(start = CoroutineStart.UNDISPATCHED) { | ||
val channel = stream.responseChannel() | ||
var retry = 0 | ||
while (!stream.isReceiveClosed() && !channel.isClosedForReceive) { | ||
val receiveResult = channel.receiveCatching() | ||
receiveResult.onSuccess { | ||
attachment.document.publishEvent(StreamConnectionChange.Connected) |
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.
don't we need this line?
if the stream fails then succeed on retry, users would not receive the connected state.
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 missed it. fixed in 4f46596
Some tests are failing in the CI, but I checked they're working fine with the real server. I'll investigate these failing tests after merging. |
What this PR does / why we need it?
Any background context you want to provide?
What are the relevant tickets?
Fixes #
Checklist