diff --git a/index-scheduler/src/index_mapper.rs b/index-scheduler/src/index_mapper.rs index b49614331..cad74a4b6 100644 --- a/index-scheduler/src/index_mapper.rs +++ b/index-scheduler/src/index_mapper.rs @@ -66,11 +66,15 @@ impl IndexMapper { /// Create or open an index in the specified path. /// The path *must* exists or an error will be thrown. - fn create_or_open_index(&self, path: &Path, date: Option<(time::OffsetDateTime, time::OffsetDateTime)>) -> Result { + fn create_or_open_index( + &self, + path: &Path, + date: Option<(time::OffsetDateTime, time::OffsetDateTime)>, + ) -> Result { let mut options = EnvOpenOptions::new(); options.map_size(clamp_to_page_size(self.index_size)); options.max_readers(1024); - + if date == None { Ok(Index::new(options, path)?) } else { @@ -80,7 +84,12 @@ impl IndexMapper { } /// Get or create the index. - pub fn create_index(&self, mut wtxn: RwTxn, name: &str, date: Option<(time::OffsetDateTime, time::OffsetDateTime)>) -> Result { + pub fn create_index( + &self, + mut wtxn: RwTxn, + name: &str, + date: Option<(time::OffsetDateTime, time::OffsetDateTime)>, + ) -> Result { match self.index(&wtxn, name) { Ok(index) => { wtxn.commit()?; diff --git a/index-scheduler/src/lib.rs b/index-scheduler/src/lib.rs index 9e39b4cf3..a9068adb4 100644 --- a/index-scheduler/src/lib.rs +++ b/index-scheduler/src/lib.rs @@ -867,7 +867,7 @@ impl IndexScheduler { /// Create a new index without any associated task. pub fn create_raw_index(&self, name: &str) -> Result { let wtxn = self.env.write_txn()?; - let date = Some(( time::OffsetDateTime::now_utc(), time::OffsetDateTime::now_utc() )); + let date = Some((time::OffsetDateTime::now_utc(), time::OffsetDateTime::now_utc())); let index = self.index_mapper.create_index(wtxn, name, date)?; Ok(index)