-
Notifications
You must be signed in to change notification settings - Fork 209
cancel enqueued rpcs on receiving IDontWant #648
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
base: master
Are you sure you want to change the base?
Conversation
5ce8912
to
4f30121
Compare
4f30121
to
2ce4fe8
Compare
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.
some small changes, but I think we should merge this.
pubsub.go
Outdated
|
||
messagesInNextRPC := 0 | ||
messageSlice := rpc.Publish | ||
var msgIDSlice []string |
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.
reminder to run the fuzzer after this change
pubsub.go
Outdated
if len(rpc.MsgIDs) == 0 { | ||
msgIDSlice = make([]string, len(rpc.Publish)) | ||
} else { | ||
panic("MsgIDs and Publish have different lengths") |
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.
Is panic the best option? Is there a reason it's unsafe to use rpc.Publish as the source of truth?
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.
This effectively says: panic if the MessageIDs are present but the length is < rpc.Publish length. I'm panicing here because it'd have paniced in the append later in the loop.
I'm changing this to work for any len of MessageIDs. Slightly ugly but also avoids allocation.
fc75da8
to
3476c19
Compare
3476c19
to
2926d76
Compare
fixes: #611