From cd462f4811c2e7ba8368ff2260d88dc93cb5cdea Mon Sep 17 00:00:00 2001 From: "nobu.maeda" Date: Tue, 2 Jan 2024 23:41:50 +0800 Subject: [PATCH] Add initial persistance to Maker & Taker data stores --- src/maker/data.rs | 7 ++++--- src/taker/data.rs | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/maker/data.rs b/src/maker/data.rs index 15fdd1a..40ed5cd 100644 --- a/src/maker/data.rs +++ b/src/maker/data.rs @@ -85,13 +85,14 @@ impl MakerActorData { let store = Arc::new(RwLock::new(store)); let (persist_tx, task_handle) = Self::setup_persistance(store.clone(), trade_uuid, &dir_path); - - Self { + let data = Self { persist_tx, trade_uuid, store, task_handle, - } + }; + data.queue_persistance(); + data } pub(crate) async fn restore(data_path: impl AsRef) -> Result<(Uuid, Self), N3xbError> { diff --git a/src/taker/data.rs b/src/taker/data.rs index 4b2eb75..9e00787 100644 --- a/src/taker/data.rs +++ b/src/taker/data.rs @@ -70,13 +70,14 @@ impl TakerActorData { let store = Arc::new(RwLock::new(store)); let (persist_tx, task_handle) = Self::setup_persistance(store.clone(), trade_uuid, &dir_path); - - Self { + let data = Self { persist_tx, trade_uuid, store, task_handle, - } + }; + data.queue_persistance(); + data } pub(crate) async fn restore(data_path: impl AsRef) -> Result<(Uuid, Self), N3xbError> {