Spawn a background task that batches and pushes log lines to the server. Returns the sender half of the channel (for the [`LogPushLayer`]) and the task handle. The task runs until the sender is dropped or the gRPC stream breaks.
(
endpoint: String,
sandbox_id: String,
)
| 95 | /// task handle. The task runs until the sender is dropped or the gRPC stream |
| 96 | /// breaks. |
| 97 | pub fn spawn_log_push_task( |
| 98 | endpoint: String, |
| 99 | sandbox_id: String, |
| 100 | ) -> (mpsc::Sender<SandboxLogLine>, tokio::task::JoinHandle<()>) { |
| 101 | let (tx, rx) = mpsc::channel::<SandboxLogLine>(1024); |
| 102 | |
| 103 | let handle = tokio::spawn(run_push_loop(endpoint, sandbox_id, rx)); |
| 104 | |
| 105 | (tx, handle) |
| 106 | } |
| 107 | |
| 108 | /// Maximum backoff delay between reconnection attempts. |
| 109 | const MAX_BACKOFF: tokio::time::Duration = tokio::time::Duration::from_secs(30); |
no test coverage detected