From e22debb994cbc603e71fdd2443cf1705bfdb17b5 Mon Sep 17 00:00:00 2001 From: Quentin de Quelen Date: Wed, 20 Nov 2019 11:19:17 +0100 Subject: [PATCH] Update index updated_at information at each update callback --- meilidb-http/src/routes/index.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/meilidb-http/src/routes/index.rs b/meilidb-http/src/routes/index.rs index ff9a2998a..4eb228f92 100644 --- a/meilidb-http/src/routes/index.rs +++ b/meilidb-http/src/routes/index.rs @@ -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(); }