Skip to content

bug: reproduce 'async' assertion issues #262

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
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
6 changes: 3 additions & 3 deletions lua/gitlinker.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ local num = require("gitlinker.commons.num")
local LogLevels = require("gitlinker.commons.logging").LogLevels
local logging = require("gitlinker.commons.logging")

local async = require("gitlinker.async")
local async = require("gitlinker.commons.async")
local configs = require("gitlinker.configs")
local range = require("gitlinker.range")
local linker = require("gitlinker.linker")
Expand Down Expand Up @@ -221,7 +221,7 @@ local _link = function(opts)
lk.rev = opts.rev
end

async.scheduler()
async.schedule()
local ok, url = pcall(opts.router, lk, true)
-- logger:debug(
-- "|link| ok:%s, url:%s, router:%s",
Expand Down Expand Up @@ -273,7 +273,7 @@ local _link = function(opts)
end

--- @type fun(opts:{action:gitlinker.Action?,router:gitlinker.Router,lstart:integer,lend:integer,remote:string?,file:string?,rev:string?}):string?
local _void_link = async.void(_link)
local _void_link = async.sync(1, _link)

--- @param args string?
--- @return {router_type:string,remote:string?,file:string?,rev:string?}
Expand Down
6 changes: 3 additions & 3 deletions lua/gitlinker/git.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ local logging = require("gitlinker.commons.logging")
local spawn = require("gitlinker.commons.spawn")
local uv = require("gitlinker.commons.uv")

local async = require("gitlinker.async")
local async = require("gitlinker.commons.async")

--- @class gitlinker.CmdResult
--- @field stdout string[]
Expand Down Expand Up @@ -43,7 +43,7 @@ function CmdResult:print_err(default)
end

--- NOTE: async functions can't have optional parameters so wrap it into another function without '_'
local _run_cmd = async.wrap(function(args, cwd, callback)
local _run_cmd = async.wrap(3, function(args, cwd, callback)
local result = CmdResult:new()
local logger = logging.get("gitlinker")
logger:debug(string.format("|_run_cmd| args:%s, cwd:%s", vim.inspect(args), vim.inspect(cwd)))
Expand All @@ -64,7 +64,7 @@ local _run_cmd = async.wrap(function(args, cwd, callback)
logger:debug(string.format("|_run_cmd| result:%s", vim.inspect(result)))
callback(result)
end)
end, 3)
end)

-- wrap the git command to do the right thing always
--- @package
Expand Down
6 changes: 3 additions & 3 deletions lua/gitlinker/linker.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
local logging = require("gitlinker.commons.logging")
local str = require("gitlinker.commons.str")

local async = require("gitlinker.async")
local async = require("gitlinker.commons.async")
local git = require("gitlinker.git")
local path = require("gitlinker.path")
local giturlparser = require("gitlinker.giturlparser")
Expand Down Expand Up @@ -89,7 +89,7 @@ local function make_linker(remote, file, rev)
end
-- logger.debug("|linker - Linker:make| rev:%s", vim.inspect(rev))

async.scheduler()
async.schedule()

if not file_provided then
local buf_path_on_root = path.buffer_relpath(root) --[[@as string]]
Expand All @@ -114,7 +114,7 @@ local function make_linker(remote, file, rev)
-- vim.inspect(file_in_rev_result)
-- )

async.scheduler()
async.schedule()

local file_changed = false
if not file_provided then
Expand Down
Loading