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

optimize the loading of the addresses when parsing blocks #2312

Open
krtschmr opened this issue Aug 7, 2019 · 0 comments
Open

optimize the loading of the addresses when parsing blocks #2312

krtschmr opened this issue Aug 7, 2019 · 0 comments

Comments

@krtschmr
Copy link

krtschmr commented Aug 7, 2019

https://github.com/rubykube/peatio/blob/master/app/services/blockchain_service.rb#L53

this should be more like

@addresses ||= PaymentAddress.where(currency: @currencies).pluck(:address).compact

in the worker we have already the service instance, so the instance only needs to load all addresses once.
https://github.com/rubykube/peatio/blob/master/app/workers/daemons/blockchain.rb#L33

right now, if we process 10 blocks at the same time, we would load all adresses 10 times, but they never changed. hopefully this qualifies me for a degree.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant