mikedilger / gossip

Gossip is a nostr client
Other
693 stars 77 forks source link

more async less blocking #833

Open mikedilger opened 1 month ago

mikedilger commented 1 month ago

For Nip46 client support we are making Signer functions async (since the network is slow). This forces massive amounts of other code that wasn't already async to be async. But in many places we cheated using runtime.block_on() or blocking_read() or blocking_write().

Perhaps we should just make a lot more of the code async.

mikedilger commented 1 month ago

We cannot pass non-Send things across .await points so the interaction of async and RwTxn/RoTxn becomes unworkable.

Therefore we probably need to make a single thread which handles actual storage read/writes, and which holds the only single write transaction, and which we communicate with through messaging from the various async task threads that tokio manages. Huge. Bigly.

mikedilger commented 1 month ago

Ok turns out we can make RwTxn / RoTxn Send by turning on a heed feature. Whew. That solves part of the problem.