diff --git a/lua/gitlab/async.lua b/lua/gitlab/async.lua index 36905f62..ba0f143b 100644 --- a/lua/gitlab/async.lua +++ b/lua/gitlab/async.lua @@ -37,10 +37,16 @@ function async:fetch(dependencies, i, argTable) -- Call the API, set the data, and then call the next API local body = dependency.body and dependency.body(argTable) or nil + local on_error = nil + if dependency.non_blocking then + on_error = function() + self:fetch(dependencies, i + 1, argTable) + end + end job.run_job(dependency.endpoint, dependency.method or "GET", body, function(data) state[dependency.state] = dependency.key and data[dependency.key] or data self:fetch(dependencies, i + 1, argTable) - end) + end, on_error) end -- Will call APIs in sequence and set global state diff --git a/lua/gitlab/state.lua b/lua/gitlab/state.lua index 3a6df9b5..a30dc78b 100644 --- a/lua/gitlab/state.lua +++ b/lua/gitlab/state.lua @@ -538,6 +538,7 @@ M.dependencies = { key = "draft_notes", state = "DRAFT_NOTES", refresh = false, + non_blocking = true, }, project_members = { endpoint = "/project/members",