HelheimLabs / autochessia

Fully on-chain auto chess, built with MUD
https://dev.autochessia.xyz
GNU Affero General Public License v3.0
21 stars 14 forks source link

autobattle runs too frequence to take too much network usage #110

Closed noyyyy closed 1 year ago

noyyyy commented 1 year ago

@aLIEzsss4 The autobattle runs on blocknumber increase, it's can lead to excessive rpc call if the block number increase fastly.

https://github.com/HelheimLabs/autochessia/blob/cee1c570d1b7290816e76b27874aa095ff3e8a1b/packages/client/src/hooks/useBlockNumber.ts#L23-L58

The better way is to run the next autobattle only when the previous one is confirmed on chain. In this way, the front end will have a balanced rpc call requence.