-
Notifications
You must be signed in to change notification settings - Fork 5
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
Ensure PresenceChangedEvent is triggered after presences
emission
#151
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #151 +/- ##
==========================================
+ Coverage 78.46% 79.58% +1.11%
==========================================
Files 63 63
Lines 3743 3845 +102
Branches 582 601 +19
==========================================
+ Hits 2937 3060 +123
+ Misses 500 463 -37
- Partials 306 322 +16 ☔ View full report in Codecov by Sentry. |
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'm not sure if this will be consistent when presences events occur very rapidly.
Maybe we should add test codes to be sure.
|
||
else -> {} | ||
} | ||
withTimeoutOrNull(3_000) { |
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.
do we need the timeout?
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.
It is logically unnecessary, but I added it just in case of an unexpected issue which can lead to an indefinite delay in the first()
function.
I'll remove it if it looks redundant.
else -> {} | ||
} | ||
withTimeoutOrNull(3_000) { | ||
presences.first(predicate) |
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.
is it possible for presence events to be changed as below very fast that publishPresenceEvent
for publishPresenceEvent
is called after it is already unwatched?
Watched -> PresenceChanged -> Unwatched
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'm not 100% sure that situation will never happen.
I'll fix it to ensure that the PresenceChanged
event is ignored when it is already unwatched.
I haven't checked for rapidly changing presence events, so I'll look into it further and add test codes for it. |
What this PR does / why we need it?
It ensures that the
PresenceChanged
event is posted after thepresences
flow emission.Any background context you want to provide?
What are the relevant tickets?
Fixes #
Checklist