镜像自地址
https://github.com/tuna/tunasync.git
已同步 2025-12-06 06:26:46 +00:00
fix(worker): fixed job status and control logic
这个提交包含在:
@@ -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 {
|
||||
|
||||
在新工单中引用
屏蔽一个用户