MCPcopy Create free account
hub / github.com/drogus/crows / checkout_or_create_instance

Method checkout_or_create_instance

wasm/src/lib.rs:204–216  ·  view source on GitHub ↗
(&mut self)

Source from the content-addressed store, hash-verified

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
219impl RuntimeInner {

Callers 1

runMethod · 0.80

Calls 3

checkout_instanceMethod · 0.80
sendMethod · 0.80
reserve_instanceMethod · 0.80

Tested by

no test coverage detected