perf: eliminate loop string allocations and proxy mem spikes
This commit is contained in:
1 parent
d5a05f8416
commit
dc59aa9238
5 files changed
+30
-24
No files matched your search
+2
-2
@@ -96,10 +96,10 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
if let tokio_tungstenite::tungstenite::Message::Text(text) = msg {
|
||||
let log_prefix = logger::extract_log_prefix(&text, true);
|
||||
tracing::info!("<<< [Stub] Received {} from server (length: {}): {}", log_prefix, text.len(), if text.len() > 1000 { format!("{}...", &text[..1000]) } else { text.clone() });
|
||||
let payload = format!("{}\n", text);
|
||||
use tokio::io::AsyncWriteExt;
|
||||
let mut stdout = tokio::io::stdout();
|
||||
let _ = stdout.write_all(payload.as_bytes()).await;
|
||||
let _ = stdout.write_all(text.as_bytes()).await;
|
||||
let _ = stdout.write_all(b"\n").await;
|
||||
let _ = stdout.flush().await;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user