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

sdk: implement a sending queue #3465

Merged
merged 7 commits into from
Jun 3, 2024
Merged

sdk: implement a sending queue #3465

merged 7 commits into from
Jun 3, 2024

Conversation

bnjbvr
Copy link
Member

@bnjbvr bnjbvr commented May 24, 2024

Most of #3361, except for storing/reloading the local echoes from the disk.

@bnjbvr bnjbvr marked this pull request as ready for review May 27, 2024 13:42
@bnjbvr bnjbvr requested a review from a team as a code owner May 27, 2024 13:42
@bnjbvr bnjbvr requested review from andybalaam and removed request for a team May 27, 2024 13:42
@bnjbvr bnjbvr force-pushed the bnjbvr/shared-sending-queue branch 3 times, most recently from e1e0372 to 7ceace5 Compare May 27, 2024 15:26
Copy link

codecov bot commented May 27, 2024

Codecov Report

Attention: Patch coverage is 95.12195% with 8 lines in your changes are missing coverage. Please review.

Project coverage is 83.72%. Comparing base (392fd00) to head (955fb95).
Report is 25 commits behind head on main.

Files Patch % Lines
crates/matrix-sdk/src/send_queue.rs 95.89% 6 Missing ⚠️
crates/matrix-sdk/src/room/futures.rs 86.66% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3465      +/-   ##
==========================================
+ Coverage   83.63%   83.72%   +0.08%     
==========================================
  Files         254      255       +1     
  Lines       25592    25752     +160     
==========================================
+ Hits        21405    21560     +155     
- Misses       4187     4192       +5     

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

@Hywan Hywan requested review from Hywan and removed request for andybalaam May 28, 2024 09:46
@bnjbvr bnjbvr force-pushed the bnjbvr/shared-sending-queue branch from bc4da6d to edf6867 Compare May 28, 2024 13:37
@bnjbvr bnjbvr changed the title sdk: implement a sending queue and make use of it in the timeline sdk: implement a sending queue May 28, 2024
@bnjbvr
Copy link
Member Author

bnjbvr commented May 28, 2024

Extracted some bits of this PR as #3475, as an attempt to make reviewing it easier.

@bnjbvr bnjbvr force-pushed the bnjbvr/shared-sending-queue branch from edf6867 to dc0f2e8 Compare May 28, 2024 15:57
…ground

This implements the following features:

- enabling/disabling the sending queue at a client-wide granularity,
- one sending queue per room, that lives until the client is shutting
down,
- retrying sending an event three times, if it failed in the past, with
some exponential backoff to attempt to re-send,
- allowing to cancel sending an event we haven't sent yet.

fixup sdk
A client would require this to know that the sending queue has been
globally disabled, across all the rooms, otherwise they couldn't know
that it needs to be re-enabled later on.
So as to not use sync mutexes across await points, we have to use an
async mutex, BUT it can't be immediately called in a wiremock responder,
so we need to shoe-horn a bit: create a new tokio runtime, which can
only be called from another running thread, etc. It's a bit ugly, but I
couldn't find another mechanism to block the responder from returning a
Response immediately; happy to change that anytime if there's a simpler
way.
@bnjbvr bnjbvr force-pushed the bnjbvr/shared-sending-queue branch from dc0f2e8 to ae66ef2 Compare May 28, 2024 16:31
@bnjbvr bnjbvr marked this pull request as draft May 30, 2024 12:12
@bnjbvr bnjbvr marked this pull request as ready for review May 30, 2024 16:42
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.

After 1h15 in a pair-reviewing session, I approve this nice PR, well done!

@bnjbvr bnjbvr enabled auto-merge (rebase) June 3, 2024 13:29
@bnjbvr bnjbvr merged commit 78608a1 into main Jun 3, 2024
38 checks passed
@bnjbvr bnjbvr deleted the bnjbvr/shared-sending-queue branch June 3, 2024 13:30
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