-
Notifications
You must be signed in to change notification settings - Fork 98
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
[sql-3] accounts: replace calls to UpdateAccount #939
Conversation
daa5c0b
to
e557374
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.
Generally looks good! I've left a few comments below, where there's mainly one that needs to be fixed.
As also communicated offline, I do think the added options to the API UpsertAccountPayment
makes this updated version harder to read and reason about than the current implementation. I think it's worth considering if it could be designed a bit differently as I feel there's a high risk of introducing bugs when the API is a bit complicated.
e557374
to
1a69a8b
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.
I do think the added options to the API UpsertAccountPayment makes this updated version
Agreed. I do, however, want to keep this series of PRs focused on just switching out the backends without changing the existing behaviour. If we want to make behaviour better, i think it should be done separately (ideas/PRs welcome!) to keep us from scope creeping on this project.
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.
LGMT after this fix #939 (comment) 🚀!
Just as a small note, since the latest push contained both merge changes + fixes for the PR, I think that would have been a great scenario to either push PR changes separately from merge changes, or include the changes as fixups :).
// There is a case where the passed in fullAmt is zero but the pending | ||
// amount is not. In that case, we should not overwrite the pending | ||
// amount. |
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 recall when this can happen. If anyone of you knows, could we update that comment to explain it?
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 think viktor added this comment, so will leave this as a follow up for him
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.
@ViktorTigerstrom, do you recall how when that can happen?
95dd10e
to
f2459eb
Compare
oops - fixing race now |
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.
Nice, looks almost good, have two non-blocking comments
And use it in the InterceptorService's paymentUpdate method.
Instead of useing UpdateAccount.
And use it instead of UpdateAccount.
2786d53
to
a974e7a
Compare
Instead of UpdateAccount.
In this commit, we avoid race conditions that can happen for tests that directly access the service's `pendingPayment` map.
a974e7a
to
a4506c9
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.
LGTM ⚡
(similar PR description to #938 but they are not dependent on each other)
To prepare the
accounts.Store
to be more SQL compatible, we will want to replace the currentUpdateAccount
method. Today it takes a fullOffChainAccount
struct, serialises it and replacesany existing in the DB. This method is not very SQL appropriate as the better pattern is to instead
have specific update methods that read: "Update field X and account with ID Y".
So this PR starts this process of adding more SQL friendly methods to the interface and thereby
phasing out the use of
UpdateAccount
. By doing so, we also move very kvdb specific logic outof the
accounts.InterceptorService
.I'm splitting this up over about 3 or 4 PRs since some of the replacements are more complicated than
others.
This PR focuses on the calls that edit/add account payments:
UpsertAccountPayment
DeleteAccountPayment