Skip to content

Commit cf3f337

Browse files
author
Matt Corallo
committed
Reduce the tokio runtime worker thread count
There's really no reason why we need a lot of tokio threads - we don't really do anything CPU-intensive and we expect Orange SDK users to be "edge-nodes" that don't have a lot of channels. Thus, spinning up a thread per CPU core wastes a good bit of memory allocating stacks for threads we'll never use. Instead, just fix the worker thread count to two.
1 parent 7128171 commit cf3f337

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

orange-sdk/src/ffi/orange/wallet.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,9 @@ pub struct Wallet {
125125
impl Wallet {
126126
#[uniffi::constructor]
127127
pub async fn new(config: WalletConfig) -> Result<Self, InitFailure> {
128-
let rt = Arc::new(tokio::runtime::Builder::new_multi_thread().enable_all().build()?);
128+
let rt = Arc::new(
129+
tokio::runtime::Builder::new_multi_thread().worker_threads(2).enable_all().build()?,
130+
);
129131

130132
let config: OrangeWalletConfig = config.try_into()?;
131133

0 commit comments

Comments
 (0)