-
Notifications
You must be signed in to change notification settings - Fork 198
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
Conversation
f8b4150
to
cf90c94
Compare
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}) |
There was a problem hiding this comment.
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?").
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM after all
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.
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.