From 2f748480a110ddde8fa37d5a4dd7e466324d3dab Mon Sep 17 00:00:00 2001
From: Tamo <tamo@meilisearch.com>
Date: Mon, 17 Oct 2022 17:43:23 +0200
Subject: [PATCH] share the rtxn between the access to the tasks and to the
 indexes

---
 index-scheduler/src/batch.rs | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/index-scheduler/src/batch.rs b/index-scheduler/src/batch.rs
index fbbe5d878..b855f2d92 100644
--- a/index-scheduler/src/batch.rs
+++ b/index-scheduler/src/batch.rs
@@ -555,11 +555,8 @@ impl IndexScheduler {
                 }
                 dump_tasks.flush()?;
 
-                // TODO: maybe `self.indexes` could use this rtxn instead of creating its own
-                drop(rtxn);
-
                 // 3. Dump the indexes
-                for (uid, index) in self.indexes()? {
+                for (uid, index) in self.index_mapper.indexes(&rtxn)? {
                     let rtxn = index.read_txn()?;
                     let metadata = IndexMetadata {
                         uid: uid.clone(),