Skip to content

Commit bc6d668

Browse files
committed
decrease idle cpu load
1 parent 7dc7d5d commit bc6d668

File tree

4 files changed

+5
-4
lines changed

4 files changed

+5
-4
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
- defaults < `./config/tyra.toml` < environment variables
66
- removed `RouterMessage<M>`
77
- routers now support any user-defined message per default through a generic implementation
8-
8+
- increase internal sleep in `await_shutdown` to decrease cpu load
9+
910
# 0.8.0
1011

1112
- switch internal actor mailbox to `flume` from `crossbeam-channel`

src/system/actor_system.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ impl ActorSystem {
292292
/// ```
293293
pub fn await_shutdown(&self) -> i32 {
294294
while !self.state.is_stopped() {
295-
sleep(Duration::from_millis(1));
295+
sleep(Duration::from_millis(500));
296296
}
297297
return self.state.get_exit_code();
298298
}

src/system/system_state.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ impl SystemState {
6161
self.mailboxes.clear();
6262
break;
6363
}
64-
sleep(Duration::from_millis(1));
64+
sleep(Duration::from_millis(10));
6565
}
6666
self.is_stopped.store(true, Ordering::Relaxed);
6767
}

src/system/thread_pool_manager.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ impl ThreadPoolManager {
130130
});
131131
}
132132
}
133-
sleep(Duration::from_secs((1) as u64));
133+
sleep(Duration::from_millis(1000));
134134
}
135135
}
136136
}

0 commit comments

Comments
 (0)