mirror of
https://github.com/centau/vide.git
synced 2026-08-20 14:41:37 +00:00
fix recursive queue flush (#28)
* fix recursive queue flush * remove print from test * swap order of flush * simplified test case and remove error * write more in-depth tests * change approach flush_update_queue * double diamond test case * fix indent * change naming of function * subsequent updates do not batch test case * simplify test case
This commit is contained in:
parent
b85419088c
commit
fbe2f01bb9
3 changed files with 219 additions and 16 deletions
|
|
@ -6,17 +6,18 @@ local graph = require(script.Parent.graph)
|
|||
|
||||
local function batch(setter: () -> ())
|
||||
local already_batching = flags.batch
|
||||
local from
|
||||
|
||||
flags.batch = true
|
||||
if not already_batching then
|
||||
flags.batch = true
|
||||
from = graph.get_update_queue_length()
|
||||
end
|
||||
|
||||
local ok, err: string? = pcall(setter)
|
||||
|
||||
if not already_batching then
|
||||
flags.batch = false
|
||||
|
||||
if not already_batching then
|
||||
graph.flush_update_queue()
|
||||
end
|
||||
graph.flush_update_queue(from)
|
||||
end
|
||||
|
||||
if not ok then throw(`error occured while batching updates: {err}`) end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue