MCPcopy Create free account
hub / github.com/dtormoen/tsk-tsk / force_stop_proxy

Method force_stop_proxy

src/docker/proxy_manager.rs:503–518  ·  view source on GitHub ↗

Stops the proxy if no agents are connected, without acquiring the lock. This is safe to call during shutdown when all workers have been drained and no new tasks can start. Skipping the lock avoids potential deadlocks during the shutdown sequence.

(&self, proxy_config: &ResolvedProxyConfig)

Source from the content-addressed store, hash-verified

501 /// and no new tasks can start. Skipping the lock avoids potential deadlocks
502 /// during the shutdown sequence.
503 pub async fn force_stop_proxy(&self, proxy_config: &ResolvedProxyConfig) -> Result<bool> {
504 let container_name = proxy_config.proxy_container_name();
505
506 if !self.is_proxy_running(&container_name).await? {
507 return Ok(false);
508 }
509
510 let agent_count = self.count_connected_agents(&container_name).await?;
511
512 if agent_count == 0 {
513 self.stop_proxy(&container_name).await?;
514 Ok(true)
515 } else {
516 Ok(false)
517 }
518 }
519
520 /// Conditionally stops the proxy by container name if no agents are connected.
521 async fn maybe_stop_proxy_by_name(&self, container_name: &str) {

Callers 3

graceful_shutdownMethod · 0.80

Calls 4

proxy_container_nameMethod · 0.80
is_proxy_runningMethod · 0.80
stop_proxyMethod · 0.80

Tested by 2