Skip to content

Commit 64dbaeb

Browse files
committed
refactor(event_manager): throttle_ms from config
1 parent c7a6661 commit 64dbaeb

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

lua/opencode/config.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ M.defaults = {
9494
rendering = {
9595
markdown_debounce_ms = 250,
9696
on_data_rendered = nil,
97+
event_throttle_ms = 40,
9798
},
9899
tools = {
99100
show_output = true,

lua/opencode/event_manager.lua

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,11 @@ function EventManager.new()
136136
captured_events = {},
137137
}, EventManager)
138138

139-
-- TODO: make drain delay configurable
139+
local config = require('opencode.config')
140+
local throttle_ms = config.ui.output.rendering.event_throttle_ms
140141
self.throttling_emitter = ThrottlingEmitter.new(function(events)
141142
self:_on_drained_events(events)
142-
end, 40)
143+
end, throttle_ms)
143144

144145
return self
145146
end

lua/opencode/types.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@
104104
---@class OpencodeUIOutputConfig
105105
---@field tools { show_output: boolean }
106106
---@field rendering { markdown_debounce_ms: number, on_data_rendered: (fun(buf: integer, win: integer)|boolean)|nil }
107+
---@field event_throttle_ms number
107108

108109
---@class OpencodeContextConfig
109110
---@field enabled boolean

0 commit comments

Comments
 (0)