I want to manage a worker that loops over events and should finish as many tasks as possible in one transaction. Nodes have a config for
max-transaction-time = 30.
- Is 30ms used on mainnet for all BP nodes?
- Can I obtain the max time I have remaining according to my staked CPU in my contract?
- The avg. runtime per iteration depends on the BP hardware. I can, however. provide safe estimates from local measurements. Is there a better way to live measure runtime? I assume there is none due to the deterministic nature of the TXs.
In the end I want to stop after n iterations with
n = 0.9 x available CPU time / avg iteration time (0.9 is some safety margin).