提交 b64c7a63 编写于 作者: G gongweibao

fix by helin's comments

上级 a40a7a5c
...@@ -114,7 +114,7 @@ func (c *Client) taskFinished(taskID int) error { ...@@ -114,7 +114,7 @@ func (c *Client) taskFinished(taskID int) error {
// TaskFailed tell the master server as task is failed. // TaskFailed tell the master server as task is failed.
func (c *Client) taskFailed(meta TaskMeta) error { func (c *Client) taskFailed(meta TaskMeta) error {
return c.conn.Call("Service.TaskFinished", meta, nil) return c.conn.Call("Service.TaskFailed", meta, nil)
} }
// NextRecord returns next record in the dataset. // NextRecord returns next record in the dataset.
......
...@@ -99,6 +99,12 @@ func TestGetFinishTask(t *testing.T) { ...@@ -99,6 +99,12 @@ func TestGetFinishTask(t *testing.T) {
if err != nil { if err != nil {
t.Fatalf("Error: %v, pass: %d\n", err, i) t.Fatalf("Error: %v, pass: %d\n", err, i)
} }
err = c.taskFailed(tasks[0].Meta)
if err != nil {
t.Fatalf("Error: %v, pass: %d\n", err, i)
}
tasks = tasks[1:] tasks = tasks[1:]
task, err := c.getTask() task, err := c.getTask()
if err != nil { if err != nil {
......
...@@ -359,7 +359,7 @@ func (s *Service) GetTask(dummy int, task *Task) error { ...@@ -359,7 +359,7 @@ func (s *Service) GetTask(dummy int, task *Task) error {
} }
*task = t.Task *task = t.Task
log.WithFields(s.logFields()).Infof("Task #%v dispatched.", t.Meta) log.WithFields(s.logFields()).Infof("Task #%v dispatched.", t.Task.Meta)
time.AfterFunc(s.timeoutDur, s.checkTimeoutFunc(t.Task.Meta.ID, t.Task.Meta.Epoch)) time.AfterFunc(s.timeoutDur, s.checkTimeoutFunc(t.Task.Meta.ID, t.Task.Meta.Epoch))
return nil return nil
...@@ -376,7 +376,6 @@ func (s *Service) TaskFinished(taskID int, dummy *int) error { ...@@ -376,7 +376,6 @@ func (s *Service) TaskFinished(taskID int, dummy *int) error {
t, ok := s.taskQueues.Pending[taskID] t, ok := s.taskQueues.Pending[taskID]
if !ok { if !ok {
err := errors.New("pending task not found")
log.WithFields(s.logFields()).Warningln("Pending task #%d not found.", taskID) log.WithFields(s.logFields()).Warningln("Pending task #%d not found.", taskID)
return nil return nil
} }
...@@ -412,8 +411,7 @@ func (s *Service) TaskFailed(meta TaskMeta, dummy *int) error { ...@@ -412,8 +411,7 @@ func (s *Service) TaskFailed(meta TaskMeta, dummy *int) error {
t, ok := s.taskQueues.Pending[meta.ID] t, ok := s.taskQueues.Pending[meta.ID]
if !ok { if !ok {
err := errors.New("pending task not found") log.WithFields(s.logFields()).Warningln("TaskFailed:Pending task #%v not found.", t.Task.Meta)
log.WithFields(s.logFields()).Warningln("TaskFailed:Pending task #%v not found.", t.Meta)
return nil return nil
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册