🐛 quickfix: nil point

This commit is contained in:
naiba 2021-01-18 13:45:06 +08:00
parent 769b61843e
commit c5379a0092
5 changed files with 5 additions and 6 deletions

View File

@ -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` **重大更新** - `dashboard 0.2.0` `agent 0.2.0` **重大更新**

View File

@ -198,8 +198,8 @@ func doTask(task *pb.Task) {
} }
case model.MonitorTypeICMPPing: case model.MonitorTypeICMPPing:
pinger, err := ping.NewPinger(task.GetData()) pinger, err := ping.NewPinger(task.GetData())
pinger.SetPrivileged(true)
if err == nil { if err == nil {
pinger.SetPrivileged(true)
pinger.Count = 10 pinger.Count = 10
pinger.Timeout = time.Second * 20 pinger.Timeout = time.Second * 20
err = pinger.Run() // Blocks until finished. err = pinger.Run() // Blocks until finished.

View File

@ -17,7 +17,7 @@ type Server struct {
Host *Host `gorm:"-"` Host *Host `gorm:"-"`
State *HostState `gorm:"-"` State *HostState `gorm:"-"`
LastActive *time.Time `gorm:"-"` LastActive time.Time `gorm:"-"`
TaskClose chan error `gorm:"-" json:"-"` TaskClose chan error `gorm:"-" json:"-"`
TaskStream pb.NezhaService_RequestTaskServer `gorm:"-" json:"-"` TaskStream pb.NezhaService_RequestTaskServer `gorm:"-" json:"-"`

View File

@ -27,7 +27,7 @@ var ServerLock sync.RWMutex
var SortedServerList []*model.Server var SortedServerList []*model.Server
var SortedServerLock sync.RWMutex var SortedServerLock sync.RWMutex
var Version = "v0.2.5" var Version = "v0.2.6"
func ReSortServer() { func ReSortServer() {
ServerLock.RLock() ServerLock.RLock()

View File

@ -88,8 +88,7 @@ func (s *NezhaHandler) ReportSystemState(c context.Context, r *pb.State) (*pb.Re
state := model.PB2State(r) state := model.PB2State(r)
dao.ServerLock.RLock() dao.ServerLock.RLock()
defer dao.ServerLock.RUnlock() defer dao.ServerLock.RUnlock()
now := time.Now() dao.ServerList[clientID].LastActive = time.Now()
dao.ServerList[clientID].LastActive = &now
dao.ServerList[clientID].State = &state dao.ServerList[clientID].State = &state
return &pb.Receipt{Proced: true}, nil return &pb.Receipt{Proced: true}, nil
} }