diff --git a/README.md b/README.md index ea93014..457cc1c 100644 --- a/README.md +++ b/README.md @@ -205,7 +205,7 @@ URL 里面也可放置占位符,请求时会进行简单的字符串替换。 ## 变更日志 -最新:`dashboard 0.2.5` `agent 0.2.5`,只记录最后一次更新导致必须更新面板的说明。 +最新:`dashboard 0.2.6` `agent 0.2.5`,只记录最后一次更新导致必须更新面板的说明。 - `dashboard 0.2.0` `agent 0.2.0` **重大更新** diff --git a/cmd/agent/main.go b/cmd/agent/main.go index b7eddd5..f529fc7 100644 --- a/cmd/agent/main.go +++ b/cmd/agent/main.go @@ -198,8 +198,8 @@ func doTask(task *pb.Task) { } case model.MonitorTypeICMPPing: pinger, err := ping.NewPinger(task.GetData()) - pinger.SetPrivileged(true) if err == nil { + pinger.SetPrivileged(true) pinger.Count = 10 pinger.Timeout = time.Second * 20 err = pinger.Run() // Blocks until finished. diff --git a/model/server.go b/model/server.go index b21a976..e7d3de1 100644 --- a/model/server.go +++ b/model/server.go @@ -17,7 +17,7 @@ type Server struct { Host *Host `gorm:"-"` State *HostState `gorm:"-"` - LastActive *time.Time `gorm:"-"` + LastActive time.Time `gorm:"-"` TaskClose chan error `gorm:"-" json:"-"` TaskStream pb.NezhaService_RequestTaskServer `gorm:"-" json:"-"` diff --git a/service/dao/dao.go b/service/dao/dao.go index a44a3ff..0a11083 100644 --- a/service/dao/dao.go +++ b/service/dao/dao.go @@ -27,7 +27,7 @@ var ServerLock sync.RWMutex var SortedServerList []*model.Server var SortedServerLock sync.RWMutex -var Version = "v0.2.5" +var Version = "v0.2.6" func ReSortServer() { ServerLock.RLock() diff --git a/service/rpc/nezha.go b/service/rpc/nezha.go index f1cc520..a16e7e3 100644 --- a/service/rpc/nezha.go +++ b/service/rpc/nezha.go @@ -88,8 +88,7 @@ func (s *NezhaHandler) ReportSystemState(c context.Context, r *pb.State) (*pb.Re state := model.PB2State(r) dao.ServerLock.RLock() defer dao.ServerLock.RUnlock() - now := time.Now() - dao.ServerList[clientID].LastActive = &now + dao.ServerList[clientID].LastActive = time.Now() dao.ServerList[clientID].State = &state return &pb.Receipt{Proced: true}, nil }