banteg / multicall.py

aggregate results of multiple smart contract calls into one
MIT License
251 stars 108 forks source link

Consider switching to ThreadPoolExecutor #38

Closed stas closed 2 years ago

stas commented 2 years ago

Captura de ecrã de 2022-06-07 13 52 11

We're running multicall in a background worker and we could see an abnormal usage of the memory. After reviewing the implementation and switching to concurrent.futures.ThreadPoolExecutor, the processes stopped leaking memory.

Relevant line of code: https://github.com/banteg/multicall.py/blob/master/multicall/utils.py#L27

BobTheBuidler commented 2 years ago

This was fixed in #44 .

Encoding/decoding now takes place serially, but multiprocessing can still be enabled via a "MULTICALL_PROCESSES" env var.