From 6638eca1085e23b5c64cbb29a93b63b03dae14d6 Mon Sep 17 00:00:00 2001 From: Dag Wullt Date: Thu, 27 Apr 2023 17:12:47 +0200 Subject: [PATCH] Move direct reads --- monstache.go | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/monstache.go b/monstache.go index 6602643..fdb4711 100644 --- a/monstache.go +++ b/monstache.go @@ -4492,6 +4492,18 @@ func (ic *indexClient) startReadWait() { ic.stopAllWorkers() ic.doneC <- 30 } + return + } + + if len(ic.config.DirectReadNs) > 0 { + ic.rwmutex.RLock() + infoLog.Println("Direct reads completed") + if ic.config.DirectReadStateful { + if err := ic.saveDirectReadNamespaces(); err != nil { + errorLog.Printf("Error saving direct read state: %s", err) + } + } + ic.rwmutex.RUnlock() } }() } @@ -5090,18 +5102,6 @@ func (ic *indexClient) closeClient() { if ic.bulkStats != nil { ic.bulkStats.Close() } - if len(ic.config.DirectReadNs) > 0 { - ic.rwmutex.RLock() - if !ic.directReadsPending { - infoLog.Println("Direct reads completed") - if ic.config.DirectReadStateful { - if err := ic.saveDirectReadNamespaces(); err != nil { - errorLog.Printf("Error saving direct read state: %s", err) - } - } - } - ic.rwmutex.RUnlock() - } close(ic.closeC) }