-
Notifications
You must be signed in to change notification settings - Fork 249
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
[WIP] status-im/status-react#9203 BalanceAt caching #1744
Conversation
Pull Request Checklist
|
Jenkins BuildsClick to see older builds (24)
|
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, I would try to put the cache into a struct and assign an owner of it.
services/wallet/concurrent.go
Outdated
balanaceMapLock.RLock() | ||
defer balanaceMapLock.RUnlock() | ||
|
||
balance, exists := balancesCache[account][blockNumber] |
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.
balance, exists := balancesCache[account][blockNumber] | |
return balancesCache[account][blockNumber] |
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.
if I do so how do I check whether map contains the value? because I also have to change signature of the function and it wouldn't return that ok
value or something
services/wallet/concurrent.go
Outdated
defer balanaceMapLock.RUnlock() | ||
|
||
balance, exists := balancesCache[account][blockNumber] | ||
return balance, exists |
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.
return balance, exists |
Sorry, I didn't notice it's WIP... |
@adambabik not like I really understand what you mean :D I could add the last thing I wanted to have in this PR (checking of |
49171d1
to
c5fd527
Compare
@adambabik |
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.
Looks great! 👏 A few details that can be improved.
1b066d5
to
ffa7903
Compare
@adambabik should be fixed now |
a1c6bb4
to
9f60462
Compare
a726462
to
330d177
Compare
status-im/status-mobile#9203
what's already fixed here:
eth_getBalance
requests in 3-4 timesstatus: ready