AleoNet/aleo-setup

Heartbeat for browser contributor should be run in parallel with contributions

Opened this issue · 0 comments

Currently the heartbeat could stall if the contributions are taking a long time, or waiting a long time for an item in the queue to make the next contribution. Kind of makes the heartbeat a little useless for web contributors, because the drop check also works on contributions, and at the moment there is only one heartbeat per contribution (in lock step).
https://github.com/AleoHQ/aleo-setup/blob/master/phase1-wasm/src/contributor.rs#L42

The heartbeat should be executed in parallel to the contributions. I'm assuming the attempt_contribution() is a non-blocking async function that gets shelled out to web workers, so could use select! over the contribution loop and the heartbeat loop, closing the heartbeat loop when the contribution loop completes.