Skip to content

fix(ffi): propagate initial values before the future is picked by a runtime #4820

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

Merged
merged 1 commit into from
Mar 26, 2025

Conversation

bnjbvr
Copy link
Member

@bnjbvr bnjbvr commented Mar 20, 2025

Same spirit as #4818; doing work after the async move "moves" the code inside the future, and it will be executed only when a tokio runtime is available, instead of doing it right away. We can improve and do it right away in a few cases:

  • when getting the initial timeline items
  • when looking at the room directory search results

I've audited all the spawns at the FFI layer, so we should be in a good shape now.

@bnjbvr bnjbvr requested a review from a team as a code owner March 20, 2025 10:01
@bnjbvr bnjbvr requested review from poljar and removed request for a team March 20, 2025 10:01
Copy link

codecov bot commented Mar 20, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 86.46%. Comparing base (5acaaf5) to head (791e0f8).
Report is 60 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4820   +/-   ##
=======================================
  Coverage   86.45%   86.46%           
=======================================
  Files         297      297           
  Lines       34565    34565           
=======================================
+ Hits        29884    29885    +1     
+ Misses       4681     4680    -1     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Member

@Hywan Hywan left a comment

Choose a reason for hiding this comment

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

Yup, makes sense! Thanks for the fixes.

@Hywan
Copy link
Member

Hywan commented Mar 21, 2025

I honestly don't understand the error on Complement Crypto.

https://github.com/matrix-org/complement-crypto/blob/23821cf6320beb15b20233dc5728a019fcc02f15/internal/api/rust/rust.go#L720-L721

The listener should be called the same way. If we are hitting a timeout, it means the listener isn't called, which is surprising as it should be called… faster.

@bnjbvr
Copy link
Member Author

bnjbvr commented Mar 24, 2025

Kegan reported that the complement-crypto test expects to get the first events after AddTimelineListener has returned, not while it happens, so it's likely deadlocking somewhere. @kegsay would you kindly help us and rework the Go code so it works with this breaking change, please? Otherwise we can also disable the complement-crypto testing in the meanwhile.

@bnjbvr bnjbvr removed the request for review from poljar March 24, 2025 11:21
@Hywan
Copy link
Member

Hywan commented Mar 26, 2025

Re-run the complement crypto job now there is matrix-org/complement-crypto#169.

@bnjbvr bnjbvr merged commit b83889d into main Mar 26, 2025
43 checks passed
@bnjbvr bnjbvr deleted the bnjbvr/ffi-call-initial-values-before-future branch March 26, 2025 10:18
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.

2 participants