Skip to content
Snippets Groups Projects
Commit ecc4e2c4 authored by Georgy Moshkin's avatar Georgy Moshkin :speech_balloon:
Browse files

fix: disable logging from non-main threads because of performance problems

parent 9d52b582
No related branches found
No related tags found
1 merge request!1301fix: disable logging from non-main threads because of performance problems
Pipeline #51096 failed
......@@ -639,6 +639,10 @@ fn init_common(
}
cbus::init_cbus_endpoint();
// There's a problem with cbus channels at the moment, they introduce too
// much performance penalty when polling them if they're empty,
// so we only enable the thread-safe logger in debug builds for now
#[cfg(debug_assertions)]
tlog::init_thread_safe_logger();
if config.instance.shredding() {
......
......@@ -189,8 +189,10 @@ pub fn log_from_non_tx_thread(level: slog::Level, message: String) {
return;
};
// TODO: check log level and exit early
let sender = sender.as_ref().expect("is set at picodata startup");
let Some(sender) = sender.as_ref() else {
// Thread-safe logger is disabled
return;
};
let res = sender.send(ThreadSafeLogRequest {
thread_name: std::thread::current().name().unwrap_or("<unknown>").into(),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment