Skip to content

Commit

Permalink
fix: set tokio worker threads to 8
Browse files Browse the repository at this point in the history
This fixes deadlocking issues on the RPI, but also causes high CPU usage (300-400%).
  • Loading branch information
rolznz committed May 31, 2024
1 parent 615d714 commit 6f5cbdc
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,11 @@ impl Node {

log_info!(self.logger, "Starting up LDK Node on network: {}", self.config.network);

let runtime = tokio::runtime::Builder::new_multi_thread().enable_all().build().unwrap();
let runtime = tokio::runtime::Builder::new_multi_thread()
.worker_threads(8)
.enable_all()
.build()
.unwrap();

// Block to ensure we update our fee rate cache once on startup
let fee_estimator = Arc::clone(&self.fee_estimator);
Expand Down Expand Up @@ -1233,8 +1237,12 @@ impl Node {
];

tokio::task::block_in_place(move || {
tokio::runtime::Builder::new_multi_thread().enable_all().build().unwrap().block_on(
async move {
tokio::runtime::Builder::new_multi_thread()
.worker_threads(8)
.enable_all()
.build()
.unwrap()
.block_on(async move {
let now = Instant::now();
let fee_estimator = Arc::clone(&self.fee_estimator);
let fee_update_timestamp =
Expand Down Expand Up @@ -1303,8 +1311,7 @@ impl Node {
Err(e.into())
},
}
},
)
})
})
}

Expand Down

0 comments on commit 6f5cbdc

Please sign in to comment.