(&mut self)
| 202 | } |
| 203 | |
| 204 | pub async fn checkout_or_create_instance(&mut self) -> anyhow::Result<InstanceHandle> { |
| 205 | // TODO: I don't have time to refactor this code, but I don't really like trying in a loop |
| 206 | // the loop is needed because if we create instance and other task fetches it, we might |
| 207 | // still end up with None |
| 208 | loop { |
| 209 | if let Some(handle) = self.checkout_instance().await { |
| 210 | self.info_sender.send(InfoMessage::InstanceCheckedOut); |
| 211 | return Ok(handle); |
| 212 | } else { |
| 213 | self.reserve_instance().await?; |
| 214 | } |
| 215 | } |
| 216 | } |
| 217 | } |
| 218 | |
| 219 | impl RuntimeInner { |
no test coverage detected