Skip to content

Commit

Permalink
docs: update {add, get}_available_worker documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
SantiagoPittella committed Nov 26, 2024
1 parent d7e93b9 commit a31360a
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions bin/tx-prover/src/proxy/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,17 @@ impl LoadBalancer {
}
}

/// Get an available worker
/// Gets an available worker and removes it from the list of available workers.
///
/// This method will return the first available worker from the list of available workers, and
/// remove it from the list.
/// If no worker is available, it will return None.
pub async fn get_available_worker(&self) -> Option<Backend> {
self.available_workers.write().await.pop()
}

/// Set an available worker
/// Adds the provided worker to the list of available workers.
///
/// This method will add a worker to the list of available workers.
/// If the worker is already available, it will panic.
/// # Panics
/// Panics if the provided worker is already in the list of available workers.
pub async fn add_available_worker(&self, worker: Backend) {
let mut available_workers = self.available_workers.write().await;
assert!(!available_workers.contains(&worker), "Worker already available");
Expand Down

0 comments on commit a31360a

Please sign in to comment.