From 4e6c81ff9f913f1393afe6ff68103dc23feff023 Mon Sep 17 00:00:00 2001 From: delphinus Date: Sun, 10 Sep 2023 10:44:14 +0900 Subject: [PATCH] chore: add sleep to show results at first --- lua/frecency/finder.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lua/frecency/finder.lua b/lua/frecency/finder.lua index d44945ec..51b639ee 100644 --- a/lua/frecency/finder.lua +++ b/lua/frecency/finder.lua @@ -43,7 +43,7 @@ Finder.new = function(database, entry_maker, fs, need_scandir, path, recency, st local tx, rx = async.control.channel.mpsc() self.rx = rx async.run(function() - -- NOTE: return to the main loop + -- NOTE: return to the main loop to show the main window async.util.sleep(0) local seen = {} for i, file in ipairs(self:get_results(path, datetime)) do @@ -53,6 +53,8 @@ Finder.new = function(database, entry_maker, fs, need_scandir, path, recency, st table.insert(self.entries, entry) tx.send(entry) end + -- NOTE: return to the main loop to show results from DB + async.util.sleep(self.config.sleep_interval) if need_scandir and path then local count = 0 local index = #self.entries