Skip to main content

try_reserve_runner

Function try_reserve_runner 

Source
pub async fn try_reserve_runner(
    runners: &Arc<RwLock<HashMap<String, AgentRunner>>>,
    session_id: &str,
    event_sender: &Sender<AgentEvent>,
) -> Option<CancellationToken>
Expand description

Try to reserve a runner for the given session.

If a runner with Running status already exists, returns None (caller should skip execution).

Otherwise removes any stale runner and inserts a fresh one, returning the associated CancellationToken.