Skip to content

Commit 763702e

Browse files
committed
fix(spinner): freeze
1 parent 999e537 commit 763702e

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

lua/leetcode/logger/spinner/init.lua

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ local spinners = {
3131
},
3232
dot = {
3333
frames = { "", "", "", "", "", "", "", "" },
34-
fps = 15,
34+
fps = 8,
3535
},
3636
points = {
3737
frames = { "∙∙∙", "●∙∙", "∙●∙", "∙∙●" },
38-
fps = 7,
38+
fps = 4,
3939
},
4040
}
4141

@@ -50,7 +50,7 @@ function spinner:spin()
5050

5151
self.index = (self.index + 1) % #stype.frames
5252

53-
local fps = math.floor(1000 / #stype.frames)
53+
local fps = math.floor(1000 / stype.fps)
5454
vim.defer_fn(function() self:spin() end, fps)
5555
end
5656

@@ -60,12 +60,11 @@ end
6060
---@param lvl? integer
6161
---@param opts? table
6262
function spinner:set(msg, lvl, opts)
63+
if not self.spinner then return end
64+
6365
if msg then self:update(msg) end
6466
lvl = lvl or vim.log.levels.INFO
6567

66-
local log = require("leetcode.logger")
67-
log.debug(self.noti)
68-
6968
opts = vim.tbl_deep_extend("force", {
7069
hide_from_history = true,
7170
title = config.name,
@@ -98,13 +97,10 @@ function spinner:stop(msg, success, opts)
9897
timeout = 1500,
9998
}, opts or {})
10099

101-
self.spinner = nil
102100
local lvl = vim.log.levels[success and "INFO" or "ERROR"]
103101

104-
local log = require("leetcode.logger")
105-
log.debug({ noti = self.noti, msg = "spinner stop" })
106-
107102
self:set(msg, lvl, opts)
103+
self.spinner = nil
108104
end
109105

110106
---@param msg? string

0 commit comments

Comments
 (0)