MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / spawn_log_push_task

Function spawn_log_push_task

crates/openshell-supervisor-process/src/log_push.rs:97–106  ·  view source on GitHub ↗

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,
)

Source from the content-addressed store, hash-verified

95/// task handle. The task runs until the sender is dropped or the gRPC stream
96/// breaks.
97pub 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.
109const MAX_BACKOFF: tokio::time::Duration = tokio::time::Duration::from_secs(30);

Callers 1

mainFunction · 0.85

Calls 2

run_push_loopFunction · 0.85
spawnFunction · 0.70

Tested by

no test coverage detected