[model-gateway] minor code clean up (#15578)
This commit is contained in:
@@ -122,13 +122,9 @@ impl WorkerRegistry {
|
||||
}
|
||||
|
||||
/// Reserve (or retrieve) a stable UUID for a worker URL.
|
||||
/// Uses atomic entry API to avoid race conditions between check and insert.
|
||||
pub fn reserve_id_for_url(&self, url: &str) -> WorkerId {
|
||||
if let Some(existing_id) = self.url_to_id.get(url) {
|
||||
return existing_id.clone();
|
||||
}
|
||||
let worker_id = WorkerId::new();
|
||||
self.url_to_id.insert(url.to_string(), worker_id.clone());
|
||||
worker_id
|
||||
self.url_to_id.entry(url.to_string()).or_default().clone()
|
||||
}
|
||||
|
||||
/// Best-effort lookup of the URL for a given worker ID.
|
||||
|
||||
Reference in New Issue
Block a user