removed worker host

legacy
Avril 4 years ago
parent 5fe40069f1
commit aaf2c90af6
Signed by: flanchan
GPG Key ID: 284488987C31F630

@ -37,7 +37,7 @@ pub struct Imouto
title: Option<String>, title: Option<String>,
karada: Karada, karada: Karada,
worker: Worker, worker: Kokoro,
timestamp: post::PostTimestamp, //Note that `closed` should always be `None` in `Imouto`. We use this for post lifetimes and such timestamp: post::PostTimestamp, //Note that `closed` should always be `None` in `Imouto`. We use this for post lifetimes and such
} }
@ -56,11 +56,7 @@ impl Suspendable for Imouto
output.insert("id", self.id); output.insert("id", self.id);
output.insert("user", self.user); output.insert("user", self.user);
output.insert("title", self.title); output.insert("title", self.title);
output.insert("body", match self.worker { output.insert("body", self.worker.into_suspended().await); // consume worker if possible
Worker::Suspended(kokoro) => kokoro.into_suspended().await, // consume worker if possible
Worker::Attached(_) => self.karada.into_suspended().await, // consume body instead
_ => return Err(suspend::Error::Other(eyre::eyre!("Tried to suspend crashed worker"))),
});
//output.insert("hash", self.hash); //output.insert("hash", self.hash);
output.insert("timestamp", self.timestamp); output.insert("timestamp", self.timestamp);
into.set_object(output).await into.set_object(output).await
@ -82,7 +78,7 @@ impl Suspendable for Imouto
let (karada, worker) = { let (karada, worker) = {
let mut kokoro = Kokoro::from_suspended(body); let mut kokoro = Kokoro::from_suspended(body);
(kokoro.spawn().unwrap(), Worker::Suspended(kokoro)) (kokoro.spawn().unwrap(), kokoro)
}; };
Ok(Self { Ok(Self {
id, id,

Loading…
Cancel
Save