Removed index update debounce to resolve bug when deleting notes.
authorAdam Dullage <redacted>
Thu, 9 Feb 2023 18:15:07 +0000 (18:15 +0000)
committerAdam Dullage <redacted>
Thu, 9 Feb 2023 18:15:07 +0000 (18:15 +0000)
flatnotes/flatnotes.py

index e0d87c36a09445d62f6020b1e7523922d486d47e..782387b7323196b199f552326a96cc315925a769 100644 (file)
@@ -170,7 +170,6 @@ class Flatnotes(object):
         self.dir = dir
 
         self.index = self._load_index()
-        self.last_index_update = None
         self.update_index()
 
     @property
@@ -271,16 +270,6 @@ class Flatnotes(object):
                 self._add_note_to_index(writer, note)
                 logger.info(f"'{note.filename}' added to index")
         writer.commit()
-        self.last_index_update = datetime.now()
-
-    def update_index_debounced(self, clean: bool = False) -> None:
-        """Run update_index() but only if it hasn't been run in the last 10
-        seconds."""
-        if (
-            self.last_index_update is None
-            or (datetime.now() - self.last_index_update).seconds > 10
-        ):
-            self.update_index(clean=clean)
 
     def get_tags(self):
         """Return a list of all indexed tags."""
@@ -307,7 +296,7 @@ class Flatnotes(object):
         limit: int = None,
     ) -> Tuple[SearchResult, ...]:
         """Search the index for the given term."""
-        self.update_index_debounced()
+        self.update_index()
         term = self.pre_process_search_term(term)
         with self.index.searcher() as searcher:
             # Parse Query
git clone https://git.99rst.org/PROJECT