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 EventInsertLiveObserver gets blocked by reverting and adding lock… #6279

Closed
wants to merge 2 commits into from

Conversation

ganfra
Copy link
Member

@ganfra ganfra commented Jun 10, 2022

Fix #6278
Introduce a Lock instead of relying on Flow.

@ganfra ganfra requested review from bmarty, a team and onurays and removed request for a team June 10, 2022 10:59
observerScope.launch {
lock.withLock {
if (!results.isLoaded || results.isEmpty()) {
return@launch
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably equivalent, but is it safer to use return@withLock instead of return@launch?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honestly I don't know, but I can change if you prefer

@bmarty bmarty added the Z-NextRelease For issues and PRs which should be included in the NextRelease. label Jun 10, 2022
Copy link
Contributor

@onurays onurays left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, do you think there will be a performance effect?

if (!results.isLoaded || results.isEmpty()) {
return
}
observerScope.launch { onResultsChangedFlow.emit(results) }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we know the cause of the issue/reproduction steps?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reproduce a lot. Just sent some reactions, if you go back on room list and open again the timeline, there is a high chance you don't see the reactions as the event is not aggregated.
For the exact cause I don't know, but looks like the inner channel gets blocked by the the looper thread...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

very strange 🤔

I haven't been able to reproduce on my side, the flow always seems to emit

GIF
reactions

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(same for me, I cannot repro)

@ouchadam
Copy link
Contributor

for context, the PR that introduced the change #5909

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

100.0% 100.0% Coverage
0.0% 0.0% Duplication

Copy link
Member

@bmarty bmarty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update.
"Request changes" state to prevent merging this PR, I will cherry-pick commit on the hotfix branch.

@bmarty
Copy link
Member

bmarty commented Jun 13, 2022

Commits are included in 1.4.20

@bmarty bmarty closed this Jun 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Z-NextRelease For issues and PRs which should be included in the NextRelease.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[SDK] EventInsertLiveObserver processing is not triggered
4 participants