peatio icon indicating copy to clipboard operation
peatio copied to clipboard

optimize the loading of the addresses when parsing blocks

Open krtschmr opened this issue 5 years ago • 0 comments

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.

krtschmr avatar Aug 07 '19 13:08 krtschmr