Currently we require a 0.001 sleep time between server iterations due to the fact that we handle message reception/processing in a secondary thread. This means that the recursive function that acts as the server has nothing to wait for between runs, and thusly sort of spins out of control if there is no sleep time between recursive calls. This is not necessarily the correct design. The reason we handle message reception/processing in a secondary thread is because the server is responsible for triggering some other periodic behaviours such as dissemination and failure detection, and these must fire regularly even if a message is not received. The real solution is to make things like dissemination and failure detection asynchronous with Lwt.async, have the server wait for new messages, and handle message processing in a secondary thread.
Currently we require a 0.001 sleep time between server iterations due to the fact that we handle message reception/processing in a secondary thread. This means that the recursive function that acts as the server has nothing to wait for between runs, and thusly sort of spins out of control if there is no sleep time between recursive calls. This is not necessarily the correct design. The reason we handle message reception/processing in a secondary thread is because the server is responsible for triggering some other periodic behaviours such as dissemination and failure detection, and these must fire regularly even if a message is not received. The real solution is to make things like dissemination and failure detection asynchronous with
Lwt.async
, have the server wait for new messages, and handle message processing in a secondary thread.RELATED PRs: