From e99d824227278f22d1076f9487ca38dc8bd03a70 Mon Sep 17 00:00:00 2001 From: Nick Thomas Date: Sun, 31 Oct 2021 01:31:02 +0100 Subject: [PATCH] Keep hold of the Accounts struct --- src/delta/system.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/delta/system.rs b/src/delta/system.rs index 464f0e9..67210e6 100644 --- a/src/delta/system.rs +++ b/src/delta/system.rs @@ -39,11 +39,12 @@ pub fn run(tx: FdSender, rx: Receiver) { pub struct DeltaSystem { tx: FdSender, rx: Receiver, + accounts: Option, } impl DeltaSystem { fn new(tx: FdSender, rx: Receiver) -> Self { - Self { tx, rx } + Self { tx, rx, accounts: None } } fn user_dir() -> async_std::path::PathBuf { @@ -62,7 +63,7 @@ impl DeltaSystem { let mut config_dir = DeltaSystem::user_dir(); config_dir.push("purple-plugin-delta"); - Accounts::new("purple-plugin-delta".into(), config_dir).await.unwrap(); + self.accounts = Some(Accounts::new("purple-plugin-delta".into(), config_dir).await.unwrap()); log::info!("Looping on messages"); loop { @@ -84,6 +85,7 @@ impl DeltaSystem { if let Err(error) = result { log::error!("Error handling message: {}", error); } + logging::flush(); } }