-
Notifications
You must be signed in to change notification settings - Fork 67
feat: add transactions #146
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
Open
jsgalarraga
wants to merge
11
commits into
cachapa:master
Choose a base branch
from
jsgalarraga:feat/add-transactions
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
69c3d8a
feat: add support for transactions in getDocument
jsgalarraga 7722c86
refactor: update database field
jsgalarraga dc1b3c8
feat: add Transaction model and methods
jsgalarraga c06fa30
feat: implement runTransaction method
jsgalarraga d6c40a3
docs: update
jsgalarraga 3a92149
docs: update
jsgalarraga 6a15951
docs: add example
jsgalarraga d6fd789
refactor: make mutations unmodifiable
jsgalarraga 0cb291f
refactor: remove unnecessary futures
jsgalarraga f98a372
refactor: arrange methods
jsgalarraga efc2ccc
docs: add transaction documentation
jsgalarraga File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 appreciate recursiveness as much as anyone but here it feels a bit unwarranted, especially since it exposes
attemptandmaxAttempsin a "public" method (the class isn't supposed to be called directly but still).Since you have the transaction itself being run in a private method
_runTransaction, would it make sense to wrap the retries in a loop instead of having the function calling itself?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.
Your arguments make a lot of sense. @jsgalarraga , could you review this?
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.
Thank you @cachapa for the review. It's been some months since I implemented the solution, so I don't remember why I didn't use a loop instead of recursion.
From a quick review at the code, I believe that the catching the
abortederror in the loop and continue with it would be the hard part. However, I will think about it and try to refactor to use a loop or come up with strong reasons on why recursion might be a better solution.Unfortunately I won't be able to get into this next week, but I will work on it as soon as I can.
PS. @evandrobubiak feel free to also contribute with code. I appreciate you reviving this PR, but I would kindly ask to avoid posting a message a couple hours after the review just to put pressure on getting the feature out.
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.
@jsgalarraga thank you for getting back to me, and once again sorry for allowing this to go unreviewed for so long.
I appreciate you trying out a loop-based solution but if you think that doesn't work out I'm happy accepting the patch as-is.