-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Refactor: avoid double parsing of mutation string in ACL #3494
Conversation
fee6274
to
d153e45
Compare
d153e45
to
6f3c807
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.
Reviewed 3 of 3 files at r1.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @gitlw and @manishrjain)
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.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @gitlw and @manishrjain)
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.
Thanks for the refactoring!
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @gitlw and @manishrjain)
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.
I don't get this refactoring. It changes the sequence of mutation handling quite significantly. For e.g., we check for context, then check if the request is empty, only then we try to parse the mutation. This change reorders all of that.
What's the rationale?
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @manishrjain)
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.
Short answer:
We were calling parseMutation
already inside authorizeMutation
. I have only moved it outside and reused it in both authorizeMutation
and doMutate
/Mutate
functions
Long answer:
Earlier, we were calling parseMutation
function two places. Following is the old sequence of operations -
-> Call authorizeMutation
-> Check whether ACL feature is enabled
-> Call parseMutation
-> More code
-> Call doMutate
-> More code (somewhere here we call parseMutation
again)
I modified this sequence to -
-> Call parseMutation
[This is copied from below]
-> Call authorizeMutation
-> Check whether ACL feature is enabled
-> [Call parseMutation
(This is removed in the new code and moved up]
-> More code
-> Call doMutate
-> More code (somewhere here we call parseMutation
again)
^ [No need to call parseMutation
here any more]
Reviewable status: complete! all files reviewed, all discussions resolved
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.
Reviewed 3 of 3 files at r1.
Reviewable status: complete! all files reviewed, all discussions resolved
This change is