mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-12-05 02:55:46 +01:00
fix auto-synchronization with zk
This commit is contained in:
parent
5ce01bcb53
commit
ad7f8edff8
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user