fix: lock for receiving changes

must never have more than 1 callback consuming
This commit is contained in:
əlemi 2024-09-26 17:42:48 +02:00
parent 8a4e6e828a
commit 3ee546be4d
Signed by: alemi
GPG key ID: A4895B84D311642C

View file

@ -112,7 +112,10 @@ local function attach(name, opts)
end,
})
local lock = false
local async = vim.loop.new_async(vim.schedule_wrap(function ()
if lock then return end
lock = true
while true do
local event = controller:try_recv():await()
if event == nil then break end
@ -132,6 +135,7 @@ local function attach(name, opts)
end
end
end
lock = false
end))
local remote_content = controller:content():await()