mirror of
https://github.com/meilisearch/meilisearch.git
synced 2025-02-21 18:15:29 +08: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());
|
log::info!("Importing {} api-keys", children.len());
|
||||||
for path in children {
|
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 key = serde_json::from_slice(&key).unwrap();
|
||||||
let store = controller.store.clone();
|
let store = controller.store.clone();
|
||||||
tokio::task::spawn_blocking(move || store.put_api_key(key))
|
tokio::task::spawn_blocking(move || store.put_api_key(key))
|
||||||
.await??;
|
.await??;
|
||||||
|
|
||||||
|
},
|
||||||
|
Err(e) => panic!("{e}")
|
||||||
}
|
}
|
||||||
// else the file was deleted while we were inserting the key. We ignore it.
|
// 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
|
// TODO: What happens if someone updates the files before we have the time
|
||||||
|
Loading…
x
Reference in New Issue
Block a user