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

Always send TransactionUpdate to the sender #1111

Merged
merged 13 commits into from
May 16, 2024

Conversation

drogus
Copy link
Collaborator

@drogus drogus commented Apr 18, 2024

Description of Changes

This commit changes transaction update broadcast to always send an update to the sender, even if the sender is not subscribed to any data that was committed. In such a case, the transaction update is sent with an empty database update.

API and ABI breaking changes

None

Expected complexity level and risk

2

Testing

  • I tested using a TypeScript SDK test app
  • I've added a unit test
  • I tested using a TypeScript SDK test app
  • I've added a unit test
  • It would be best if someone can independently test that a transaction update is sent even without subscribe

@drogus drogus self-assigned this Apr 18, 2024
@drogus drogus added release-any To be landed in any release window release-alpha-maybe and removed release-alpha-maybe labels Apr 18, 2024
@@ -241,7 +246,21 @@ impl SubscriptionManager {
);
drop(span);

let _span = tracing::info_span!("eval_send").entered();
if !eval.contains_key(&event.caller_identity) {
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 want to send it to all clients with the same identity? I think probably we only want to send it to the (identity, address) pair (aka client) that made the call, right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good question. This will only send to the original caller, cause I pass the caller connection client back from the reducer call, so we won't send to all of the clients with the same identity, but there is likely a bug in the if statement itself. If there are two clients connected with the same identity and if only the client that is not making the call is subscribed, this will return false and the caller will not get the update.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The code actually has a bug related to the same issue. The list of subscriptions is indexed with identity, so if we there are two clients connected with the same identity, with different queries subscribed, one of the clients will get ignored.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

In order to fix the bug in this PR I have to fix the existing bug, so I'll submit the bugfix

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

So the bug was already fixed yesterday in #1121, I updated this PR to reflect the changes

Copy link
Contributor

Choose a reason for hiding this comment

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

Quite a saga! I'm glad it uncovered other issues though 🙏

@drogus drogus force-pushed the drogus/always-send-transaction-update-to-sender branch from 9fb125e to c4144e2 Compare April 19, 2024 12:52
@drogus drogus mentioned this pull request Apr 19, 2024
This commit changes transaction update broadcast to always send an
update to the sender, even if the sender is not subscribed to any
data that was committed. In such case the transaction update is sent
with an empty database update.
@drogus drogus force-pushed the drogus/always-send-transaction-update-to-sender branch from c4144e2 to ca7729b Compare April 19, 2024 14:15
@drogus drogus force-pushed the drogus/always-send-transaction-update-to-sender branch from 7ae1e96 to a0f932b Compare April 22, 2024 15:14
drogus and others added 3 commits May 15, 2024 15:20
Co-authored-by: Mazdak Farrokhzad <twingoow@gmail.com>
Signed-off-by: Piotr Sarnacki <drogus@gmail.com>
@drogus
Copy link
Collaborator Author

drogus commented May 15, 2024

@Centril thanks for a review, I fixed the stuff you pointed out

…ender

Signed-off-by: Piotr Sarnacki <drogus@gmail.com>
@drogus drogus force-pushed the drogus/always-send-transaction-update-to-sender branch from 3ffeddb to b31073a Compare May 16, 2024 11:31
@drogus drogus enabled auto-merge May 16, 2024 12:07
@drogus drogus added this pull request to the merge queue May 16, 2024
Merged via the queue into master with commit d08e984 May 16, 2024
6 checks passed
@drogus drogus deleted the drogus/always-send-transaction-update-to-sender branch May 16, 2024 14:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-any To be landed in any release window
Projects
None yet
4 participants