From 69e1c3c3af176a922b815964dd9891b1d2c3626d Mon Sep 17 00:00:00 2001 From: johnWang <772648576@qq.com> Date: Mon, 22 Jan 2018 15:10:38 +0800 Subject: [PATCH] update --- .gitignore | 2 ++ client/crontab.go | 14 ++++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index a0cffeab..c0675fbb 100644 --- a/.gitignore +++ b/.gitignore @@ -40,5 +40,7 @@ server/autobuild server/jiacrontab server/watchbin server/.data +server/server +clent/client diff --git a/client/crontab.go b/client/crontab.go index c6cd8711..50daad05 100644 --- a/client/crontab.go +++ b/client/crontab.go @@ -373,8 +373,12 @@ func (c *crontab) run() { c.lock.Unlock() if handle.taskPool != nil { for k, v := range handle.taskPool { - v.cancel() - log.Println("kill", task.Name, task.Id, k) + if v.cancel == nil { + log.Println("kill", task.Name, task.Id, k, "but cancel handler is nul") + } else { + v.cancel() + log.Println("kill", task.Name, task.Id, k) + } } } @@ -422,8 +426,10 @@ func (c *crontab) deal(task *proto.TaskArgs, ctx context.Context) { cancelPool := h.taskPool[0 : l-task.MaxConcurrent] h.taskPool = h.taskPool[l-task.MaxConcurrent:] for k, v := range cancelPool { - v.cancel() - log.Printf("taskPool: clean %s %d", v.name, k) + if v.cancel != nil { + v.cancel() + log.Printf("taskPool: clean %s %d", v.name, k) + } } } taskEty.exec(nil)