Skip to content

Send IDONTWANT before first publish #612

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 3 commits into from
May 20, 2025
Merged

Conversation

MarcoPolo
Copy link
Contributor

@MarcoPolo MarcoPolo commented May 6, 2025

See #610

We previously send IDONTWANT only when forwarding. This has us send IDONTWANT on our initial publish as well. Helps in the case that one or more peers may also publish the same thing at around the same time (see #610 for a longer explanation) and prevents "boomerang" duplicates where a peer sends you back the message you sent before you get a chance to send it to them.

This also serves as a hint to a peer that you are about to send them a certain message.

@MarcoPolo MarcoPolo marked this pull request as ready for review May 8, 2025 17:21
@MarcoPolo MarcoPolo force-pushed the marco/IDONTWANT-on-publish branch from f8b4150 to cf90c94 Compare May 8, 2025 21:53
@MarcoPolo MarcoPolo requested a review from raulk May 9, 2025 04:27
topic.go Outdated
@@ -349,6 +349,7 @@ func (t *Topic) validate(ctx context.Context, data []byte, opts ...PubOpt) (*Mes
}

msg := &Message{m, "", t.p.host.ID(), pub.validatorData, pub.local}
t.p.rt.PreValidation(t.p.host.ID(), []*Message{msg})
Copy link
Member

@raulk raulk May 9, 2025

Choose a reason for hiding this comment

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

While we're working on this area, how about we rename PreValidation() to something more accurate/obvious, e.g. DispatchIDONTWANT() or even something more generic like Preprocess() or Intercept()? The spirit of the method just isn't to validate (returns nothing), and it's confusing when juxtaposed with ValidateLocal() ("what validation happens in each?").

Copy link
Collaborator

Choose a reason for hiding this comment

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

names, names, names 🤣

But yes, preprocessing is what it does.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No strong opinion. Preprocess seems fine.

Copy link
Contributor

Choose a reason for hiding this comment

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

Preprocess is good for me too and no strong preference about it.

The spirit of the method just isn't to validate (returns nothing), and it's confusing when juxtaposed with ValidateLocal() ("what validation happens in each?").

PreValidation isn't supposed to validate anything. It's supposed to do something before the validation. Maybe it was because of my poor English. I checked the dictionary and it said.

"To prevalidate means to validate or verify something in advance, before it is actually used or implemented"

So you're right. Prevalidate means validate.

Copy link
Contributor

@ppopth ppopth left a comment

Choose a reason for hiding this comment

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

LGTM after all

@MarcoPolo MarcoPolo merged commit 9e5145f into master May 20, 2025
12 of 13 checks passed
@MarcoPolo MarcoPolo deleted the marco/IDONTWANT-on-publish branch May 20, 2025 00:02
@MarcoPolo MarcoPolo mentioned this pull request May 20, 2025
MarcoPolo added a commit that referenced this pull request May 29, 2025
This release contains a couple fixes and the new Batch Publishing
feature.

- #607 Batch Publishing. Useful if you are publishing a group of related
messages at once
- #612 Send IDONTWANT before initial publish. Useful when many nodes may
publish the same message at once.
- #609 Avoid sending an extra "IDONTWANT" to the peer that just sent you
a message.
- #615 10x faster rpc splitting.
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.

4 participants