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

Avoid restoring several MatrixClient #3050

Merged
merged 4 commits into from
Jun 19, 2024

Conversation

bmarty
Copy link
Member

@bmarty bmarty commented Jun 18, 2024

Type of change

  • Feature
  • Bugfix
  • Technical
  • Other :

Content

Use MatrixClientProvider instead of restoring a MatrixClient from the AuthenticationService.

Motivation and context

Attempt to fix #3028

Screenshots / GIFs

Tests

  • Step 1
  • Step 2
  • Step ...

Tested devices

  • Physical
  • Emulator
  • OS version(s):

Checklist

@bmarty bmarty requested a review from a team as a code owner June 18, 2024 16:11
@bmarty bmarty requested review from jmartinesp and removed request for a team June 18, 2024 16:11
Copy link
Contributor

github-actions bot commented Jun 18, 2024

📱 Scan the QR code below to install the build (arm64 only) for this PR.
QR code
If you can't scan the QR code you can install the build via this link: https://i.diawi.com/qkmema

@bmarty bmarty added the Run-Maestro Starts a Maestro Cloud session to run integration tests label Jun 18, 2024
@github-actions github-actions bot removed the Run-Maestro Starts a Maestro Cloud session to run integration tests label Jun 18, 2024
Copy link

codecov bot commented Jun 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 75.86%. Comparing base (7b5e7c4) to head (874bf5b).
Report is 10 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #3050      +/-   ##
===========================================
- Coverage    75.86%   75.86%   -0.01%     
===========================================
  Files         1628     1628              
  Lines        38378    38378              
  Branches      7410     7410              
===========================================
- Hits         29117    29115       -2     
- Misses        5388     5389       +1     
- Partials      3873     3874       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@jmartinesp jmartinesp left a comment

Choose a reason for hiding this comment

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

Oh, nice! Hopefully this might get rid of the duplicate refreshes.

Just a note: I was also trying to investigate this and I noticed MatrixClientProvider.restoreWithSavedState is the only method that doesn't use the Mutex to restore the session. While it's quite unlikely there may be a moment when the client already exists but sessionIdsToMatrixClient is not updated if I'm not mistaken. Maybe it's worth it to add a lock there too.

@bmarty
Copy link
Member Author

bmarty commented Jun 18, 2024

Oh, nice! Hopefully this might get rid of the duplicate refreshes.

Just a note: I was also trying to investigate this and I noticed MatrixClientProvider.restoreWithSavedState is the only method that doesn't use the Mutex to restore the session. While it's quite unlikely there may be a moment when the client already exists but sessionIdsToMatrixClient is not updated if I'm not mistaken. Maybe it's worth it to add a lock there too.

Yes, good point. I have done it a bit differently, and I think it's fine: 874bf5b is it OK for you?

@jmartinesp
Copy link
Member

Yes, good point. I have done it a bit differently, and I think it's fine: 874bf5b is it OK for you?

Yes, that's actually a lot simpler, thanks!

@bmarty bmarty merged commit eceb447 into develop Jun 19, 2024
18 checks passed
@bmarty bmarty deleted the feature/bma/concurrencyRefreshTokenfix branch June 19, 2024 07:14
Copy link

sonarcloud bot commented Jun 19, 2024

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.

Users get logged out because of (seemingly) concurrent token refresh with OIDC enabled
2 participants