From ad7f8edff8754cdf2496baa3ea2900d4b28eb114 Mon Sep 17 00:00:00 2001 From: ManyTheFish Date: Thu, 3 Aug 2023 14:43:29 +0200 Subject: [PATCH] fix auto-synchronization with zk --- meilisearch-auth/src/lib.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/meilisearch-auth/src/lib.rs b/meilisearch-auth/src/lib.rs index 489cae8ea..3cca14957 100644 --- a/meilisearch-auth/src/lib.rs +++ b/meilisearch-auth/src/lib.rs @@ -57,11 +57,16 @@ impl AuthController { log::info!("Importing {} api-keys", children.len()); for path in children { - if let Ok((key, _stat)) = zk.get_data(&path).await { + log::info!(" Importing {}", path); + match zk.get_data(&format!("/auth/{}", &path)).await { + Ok((key, _stat)) => { let key = serde_json::from_slice(&key).unwrap(); let store = controller.store.clone(); tokio::task::spawn_blocking(move || store.put_api_key(key)) .await??; + + }, + Err(e) => panic!("{e}") } // else the file was deleted while we were inserting the key. We ignore it. // TODO: What happens if someone updates the files before we have the time