diff --git a/daemon/src/connection.rs b/daemon/src/connection.rs index 2094fa1..8b3b53a 100644 --- a/daemon/src/connection.rs +++ b/daemon/src/connection.rs @@ -135,7 +135,7 @@ impl Actor { match msg { wire::MakerToTaker::Heartbeat => { - tracing::info!("got the heartbeat"); + tracing::trace!("received a heartbeat message from maker"); self.connected_state .as_mut() .expect("wire messages only to arrive in connected state") diff --git a/daemon/src/taker.rs b/daemon/src/taker.rs index 876e9b5..747ffac 100644 --- a/daemon/src/taker.rs +++ b/daemon/src/taker.rs @@ -304,7 +304,7 @@ async fn main() -> Result<()> { loop { maker_online_status_feed_receiver.changed().await.unwrap(); if maker_online_status_feed_receiver.borrow().clone() == ConnectionStatus::Offline { - tracing::info!("Maker is offline. Shutting down the taker"); + tracing::info!("Lost connection to maker, shutting down. Please restart the daemon to reconnect"); rocket::Shutdown::notify(shutdown_handle); return; } diff --git a/taker-frontend/src/App.tsx b/taker-frontend/src/App.tsx index 237bf2e..56a1b5f 100644 --- a/taker-frontend/src/App.tsx +++ b/taker-frontend/src/App.tsx @@ -45,7 +45,7 @@ async function postCfdOrderRequest(payload: CfdOrderRequestPayload) { export const App = () => { const toast = useToast(); - useBackendMonitor(toast, 5000); // 5s timeout + useBackendMonitor(toast, 5000, "Please start the taker again to reconnect..."); // 5s timeout const { lastMessage, diff --git a/taker-frontend/src/components/BackendMonitor.tsx b/taker-frontend/src/components/BackendMonitor.tsx index f899a1d..bed7309 100644 --- a/taker-frontend/src/components/BackendMonitor.tsx +++ b/taker-frontend/src/components/BackendMonitor.tsx @@ -13,7 +13,8 @@ async function fetchWithTimeout(resource: any, timeout: number) { // Check for backend's presence by sending a request to '/alive' endpoint. // When the backend's not there, the request is likely to timeout, triggering a // persistent toast notification that goes away when the daemon is back online. -export function useBackendMonitor(toast: any, timeout_ms: number): void { +// `description` is a user-facing string describing problem/possible action. +export function useBackendMonitor(toast: any, timeout_ms: number, description: string): void { const toastIdRef = useRef(); const checkForBackend: () => void = async () => { @@ -31,7 +32,7 @@ export function useBackendMonitor(toast: any, timeout_ms: number): void { if (!toastIdRef.current) { toastIdRef.current = toast({ title: "Connection Error", - description: "Daemon process is not running", + description, status: "error", position: "top", duration: timeout_ms * 100000, // we don't want this to be closed