Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion lua/gitlab/async.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions lua/gitlab/state.lua
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,7 @@ M.dependencies = {
key = "draft_notes",
state = "DRAFT_NOTES",
refresh = false,
non_blocking = true,
},
project_members = {
endpoint = "/project/members",
Expand Down
Loading