10101-PoC icon indicating copy to clipboard operation
10101-PoC copied to clipboard

chore: Introduce dedicated runtime

Open holzeis opened this issue 2 years ago • 0 comments

Annotating the function with #[tokio::main] killed the runtime after the function completes. Thus we had to block the run function indefinitely for the long living threads to keep going.

This change introduces a runtime managed outside of the function scope and thus allows the run function to return bringing the following advantages.

  • We don't block a whole frb worker thread just to run the lightning node, sync tasks, background processor, etc.
  • We are using a multi threaded runtime instead of the current thread
    • allowing to actually join the background processor without blocking all other tasks.
    • making better use of multiple cpu cores.
  • We are not creating a new runtime on every async bridge call.

holzeis avatar Dec 12 '22 15:12 holzeis