summaryrefslogtreecommitdiffstats
path: root/src/endpoint/configured.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/endpoint/configured.rs')
-rw-r--r--src/endpoint/configured.rs16
1 files changed, 5 insertions, 11 deletions
diff --git a/src/endpoint/configured.rs b/src/endpoint/configured.rs
index b703a5f..d6139ab 100644
--- a/src/endpoint/configured.rs
+++ b/src/endpoint/configured.rs
@@ -284,17 +284,11 @@ impl Endpoint {
}
pub async fn get_container_by_id<'a>(&'a self, id: &str) -> Result<Option<Container<'a>>> {
- self.container_stats()
- .await?
- .iter()
- .find(|st| st.id == id)
- .map(|_| {
- self.docker
- .containers()
- .get(id)
- })
- .map(Ok)
- .transpose()
+ if self.has_container_with_id(id).await? {
+ Ok(Some(self.docker.containers().get(id)))
+ } else {
+ Ok(None)
+ }
}
}