fix(git): stop fs watcher before closing debounce timer
This commit is contained in:
+5
-1
@@ -117,12 +117,16 @@ function Repo:start_watcher()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function Repo:stop_watcher()
|
function Repo:stop_watcher()
|
||||||
self.refresh_handle.close()
|
-- Stop the libuv watcher first so no further fs-events can trigger
|
||||||
|
-- self:refresh(); only then tear down the debounce handle. The reverse
|
||||||
|
-- order leaves a window where an in-flight watcher callback would call
|
||||||
|
-- a closed debounce timer.
|
||||||
if self.watcher then
|
if self.watcher then
|
||||||
self.watcher:stop()
|
self.watcher:stop()
|
||||||
self.watcher:close()
|
self.watcher:close()
|
||||||
self.watcher = nil
|
self.watcher = nil
|
||||||
end
|
end
|
||||||
|
self.refresh_handle.close()
|
||||||
end
|
end
|
||||||
|
|
||||||
---@param buf integer
|
---@param buf integer
|
||||||
|
|||||||
Reference in New Issue
Block a user