@@ -18,18 +18,6 @@ local function handle_api_response(response, cb)
1818 end
1919end
2020
21- function M .get_unresolved_requests ()
22- local unresolved = {}
23-
24- for _ , data in ipairs (M .requests ) do
25- if data [2 ]._resolved ~= true then
26- table.insert (unresolved , data )
27- end
28- end
29-
30- return unresolved
31- end
32-
3321--- Make an HTTP API call to the opencode server.
3422--- @generic T
3523--- @param url string The API endpoint URL
@@ -75,6 +63,8 @@ function M.call_api(url, method, body)
7563 end
7664
7765 -- For promise tracking, remove promises that complete from requests
66+ -- NOTE: can remove the request tracking code when we're happy with
67+ -- request reliability
7868 local request_entry = { opts , call_promise }
7969 table.insert (M .requests , request_entry )
8070
@@ -136,17 +126,6 @@ function M.stream_api(url, method, body, on_chunk)
136126 return curl .request (opts )
137127end
138128
139- --- Forcibly reject any pending requests (they sometimes get stuck
140- --- after an api abort)
141- function M .cancel_all_requests ()
142- for _ , entry in ipairs (M .requests ) do
143- local promise = entry [2 ]
144- if not promise :is_resolved () then
145- pcall (promise .reject , promise , ' Request cancelled' )
146- end
147- end
148- end
149-
150129function M .ensure_server ()
151130 if state .opencode_server and state .opencode_server :is_running () then
152131 return state .opencode_server
0 commit comments