From 9f6a07c90afd8a33f5ff8e699bcc711d1ab8ab11 Mon Sep 17 00:00:00 2001 From: TorchedSammy <38820196+TorchedSammy@users.noreply.github.com> Date: Tue, 17 May 2022 18:00:28 -0400 Subject: [PATCH] fix: deadlock in lua job add function and not taking proper amount of args --- job.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/job.go b/job.go index 08b526b..308cc5b 100644 --- a/job.go +++ b/job.go @@ -179,7 +179,7 @@ func (j *jobHandler) loader(rtm *rt.Runtime) *rt.Table { jobFuncs := map[string]util.LuaExport{ "all": {j.luaAllJobs, 0, false}, "get": {j.luaGetJob, 1, false}, - "add": {j.luaAddJob, 1, false}, + "add": {j.luaAddJob, 2, false}, } luaJob := rt.NewTable() @@ -209,10 +209,7 @@ func (j *jobHandler) luaGetJob(t *rt.Thread, c *rt.GoCont) (rt.Cont, error) { } func (j *jobHandler) luaAddJob(t *rt.Thread, c *rt.GoCont) (rt.Cont, error) { - j.mu.RLock() - defer j.mu.RUnlock() - - if err := c.Check1Arg(); err != nil { + if err := c.CheckNArgs(2); err != nil { return nil, err } cmd, err := c.StringArg(0)