Skip to content

Commit

Permalink
fix: use std::thread::spawn() in hot_reload_tls_cfg() instead of `t…
Browse files Browse the repository at this point in the history
…okio::spawn()` because loop{} blocks HTTP serving in some environment
  • Loading branch information
nwtgck committed Nov 23, 2021
1 parent 3a5ac1c commit 2dcb327
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,10 @@ pub fn hot_reload_tls_cfg(
load_tls_config(cert_path.deref(), key_path.deref()).unwrap(),
)));

tokio::spawn({
// NOTE: tokio::spawn() blocks servers in some environment because of `loop {}`
std::thread::spawn({
let tls_cfg_rwlock = tls_cfg_rwlock_arc.clone();
async move {
move || {
use notify::Watcher;
let (tx, rx) = std::sync::mpsc::channel();

Expand Down

0 comments on commit 2dcb327

Please sign in to comment.