From f45a00df3b924ecc54b9fc13f70dd5984d9b7f94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Renault?= <renault.cle@gmail.com> Date: Fri, 23 Aug 2019 14:39:55 +0200 Subject: [PATCH] fix: Cloned ArcSwaps are unsynchronized versions --- meilidb-data/src/database/index/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/meilidb-data/src/database/index/mod.rs b/meilidb-data/src/database/index/mod.rs index 4d35bf690..f58974f66 100644 --- a/meilidb-data/src/database/index/mod.rs +++ b/meilidb-data/src/database/index/mod.rs @@ -114,7 +114,7 @@ pub struct IndexStats { #[derive(Clone)] pub struct Index { - pub(crate) cache: ArcSwap<Cache>, + pub(crate) cache: Arc<ArcSwap<Cache>>, // TODO this will be a snapshot in the future main_index: MainIndex, @@ -185,7 +185,7 @@ impl Index { }; let cache = Cache { words, synonyms, schema, ranked_map }; - let cache = ArcSwap::from_pointee(cache); + let cache = Arc::new(ArcSwap::from_pointee(cache)); let index = Index { cache,