From d050c9b4ae0c6db1f065f4f6e0aa5f97d40d8d68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Renault?= Date: Tue, 28 Nov 2023 14:27:30 +0100 Subject: [PATCH] Only remap the main database once --- milli/src/index.rs | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/milli/src/index.rs b/milli/src/index.rs index b64aafbb3..4b15820f6 100644 --- a/milli/src/index.rs +++ b/milli/src/index.rs @@ -268,21 +268,10 @@ impl Index { ) -> heed::Result<()> { let mut txn = env.write_txn()?; // The db was just created, we update its metadata with the relevant information. - if main - .remap_types::>() - .get(&txn, main_key::CREATED_AT_KEY)? - .is_none() - { - main.remap_types::>().put( - &mut txn, - main_key::UPDATED_AT_KEY, - &updated_at, - )?; - main.remap_types::>().put( - &mut txn, - main_key::CREATED_AT_KEY, - &created_at, - )?; + let main = main.remap_types::>(); + if main.get(&txn, main_key::CREATED_AT_KEY)?.is_none() { + main.put(&mut txn, main_key::UPDATED_AT_KEY, &updated_at)?; + main.put(&mut txn, main_key::CREATED_AT_KEY, &created_at)?; txn.commit()?; } Ok(())