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

Refactor: avoid double parsing of mutation string in ACL #3494

Merged
merged 1 commit into from
Jun 1, 2019

Conversation

mangalaman93
Copy link
Contributor

@mangalaman93 mangalaman93 commented May 31, 2019

This change is Reviewable

Copy link
Contributor

@martinmr martinmr left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 3 of 3 files at r1.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @gitlw and @manishrjain)

Copy link

@gitlw gitlw left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @gitlw and @manishrjain)

Copy link

@gitlw gitlw left a 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: :shipit: complete! all files reviewed, all discussions resolved (waiting on @gitlw and @manishrjain)

Copy link
Contributor

@manishrjain manishrjain left a 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: :shipit: complete! all files reviewed, all discussions resolved (waiting on @manishrjain)

Copy link
Contributor Author

@mangalaman93 mangalaman93 left a 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: :shipit: complete! all files reviewed, all discussions resolved

Copy link
Contributor

@manishrjain manishrjain left a comment

Choose a reason for hiding this comment

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

:lgtm: I see.

Reviewed 3 of 3 files at r1.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved

@mangalaman93 mangalaman93 merged commit f2d404b into master Jun 1, 2019
@mangalaman93 mangalaman93 deleted the aman/acl_refactor branch June 1, 2019 02:47
dna2github pushed a commit to dna2fork/dgraph that referenced this pull request Jul 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants