A focused Docker Compose management web application.
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: empty logs message

Brooke f02197b0 c5739099

+13 -4
+13 -4
packages/node/src/core/logs.rs
··· 10 10 use log::{debug, error}; 11 11 use tokio::sync::{RwLock, broadcast}; 12 12 13 + const EMPTY_LOGS_MESSAGE: &[u8] = b"No logs to show. Waiting for project to start..."; 14 + 13 15 impl LuminaryEngine { 14 16 /// Creates a stream of [Bytes] for clients to subscribe to. 15 17 pub async fn logs_subscribe<'a>(&'_ self, project: String) -> BoxStream<'a, Bytes> { ··· 27 29 { 28 30 // Send previous logs in buffer to bring client up to date 29 31 let bytes = &buffer.read().await; 30 - if bytes.is_empty() { 31 - yield b"Nothing yet...".as_slice().into(); 32 - } else { 32 + if !bytes.is_empty() { 33 33 yield <BytesMut as Clone>::clone(&bytes).freeze() 34 - } 34 + } 35 35 } 36 36 37 37 let mut receiver = channel.subscribe(); ··· 90 90 91 91 // If the process exits, wait for an event from the project before triggering a retry 92 92 debug!("Docker compose logs process exited, waiting for event to trigger retry..."); 93 + 94 + // Send a message to clients if there are no logs to show 95 + { 96 + let mut buffer = buffer.write().await; 97 + if buffer.is_empty() { 98 + buffer.extend_from_slice(EMPTY_LOGS_MESSAGE); 99 + let _ = channel.send(Bytes::from(EMPTY_LOGS_MESSAGE)); 100 + } 101 + } 93 102 94 103 loop { 95 104 match this