1
0
镜像自地址 https://github.com/tuna/tunasync.git 已同步 2025-12-06 06:26:46 +00:00

fix(worker): fixed job status and control logic

这个提交包含在:
bigeagle
2016-04-28 22:46:53 +08:00
父节点 5f78722936
当前提交 292a24ba20
共有 6 个文件被更改,包括 174 次插入70 次删除

查看文件

@@ -1,6 +1,9 @@
package internal
import "time"
import (
"fmt"
"time"
)
// A StatusUpdateMsg represents a msg when
// a worker has done syncing
@@ -34,6 +37,22 @@ const (
CmdPing // ensure the goroutine is alive
)
func (c CmdVerb) String() string {
switch c {
case CmdStart:
return "start"
case CmdStop:
return "stop"
case CmdDisable:
return "disable"
case CmdRestart:
return "restart"
case CmdPing:
return "ping"
}
return "unknown"
}
// A WorkerCmd is the command message send from the
// manager to a worker
type WorkerCmd struct {
@@ -42,6 +61,13 @@ type WorkerCmd struct {
Args []string `json:"args"`
}
func (c WorkerCmd) String() string {
if len(c.Args) > 0 {
return fmt.Sprintf("%v (%s, %v)", c.Cmd, c.MirrorID, c.Args)
}
return fmt.Sprintf("%v (%s)", c.Cmd, c.MirrorID)
}
// A ClientCmd is the command message send from client
// to the manager
type ClientCmd struct {