diff --git a/src/state/local/mod.rs b/src/state/local/mod.rs index c99e27a..a117a7d 100644 --- a/src/state/local/mod.rs +++ b/src/state/local/mod.rs @@ -37,7 +37,7 @@ pub struct Imouto title: Option, 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 } @@ -56,11 +56,7 @@ impl Suspendable for Imouto output.insert("id", self.id); output.insert("user", self.user); output.insert("title", self.title); - output.insert("body", match self.worker { - 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("body", self.worker.into_suspended().await); // consume worker if possible //output.insert("hash", self.hash); output.insert("timestamp", self.timestamp); into.set_object(output).await @@ -82,7 +78,7 @@ impl Suspendable for Imouto let (karada, worker) = { let mut kokoro = Kokoro::from_suspended(body); - (kokoro.spawn().unwrap(), Worker::Suspended(kokoro)) + (kokoro.spawn().unwrap(), kokoro) }; Ok(Self { id,