forbole / flowJuno

Creative Commons Zero v1.0 Universal
2 stars 1 forks source link

Improve worker algorithm #2

Open HarleyAppleChoi opened 3 years ago

HarleyAppleChoi commented 3 years ago

Feature description

Even if a worker is now working, there are multi-calling flow endpoints that would possibly make the worker slow. That is good to improve so that each block only calls the corresponding flow RPC endpoint once.

Implementation proposal

To get the whole block, there is a order:

Block->Collection->Transaction ->TransactionResult -> Event

Currently, Collection is called multiple times in one block height, in order to get the things that need txid in Collection to retrieve from. However, that should be avoided Collection can be only called once. See how the structure of worker and client and change in order to do that

HarleyAppleChoi commented 3 years ago

To extend this one, transaction_id in Collections should be the foreign key of transaction_id at transaction, transaction result and event.