Update index updated_at information at each update callback

This commit is contained in:
Quentin de Quelen 2019-11-20 11:19:17 +01:00
parent 1b8df0ed8b
commit e22debb994

View File

@ -1,5 +1,6 @@
use chrono::{DateTime, Utc};
use http::StatusCode;
use log::*;
use meilidb_core::ProcessedUpdateResult;
use meilidb_schema::Schema;
use rand::seq::SliceRandom;
@ -314,5 +315,11 @@ pub fn index_update_callback(index_uid: &str, data: &Data, _status: ProcessedUpd
data.compute_stats(&mut writer, &index_uid).unwrap();
data.set_last_update(&mut writer).unwrap();
if let Some(index) = data.db.open_index(&index_uid) {
if let Err(e) = index.main.put_updated_at(&mut writer) {
error!("Impossible to update updated_at; {}", e)
}
}
writer.commit().unwrap();
}