Skip to content

Commit

Permalink
Remove client judgment (IceWhaleTech#862)
Browse files Browse the repository at this point in the history
  • Loading branch information
LinkLeong authored Feb 6, 2023
1 parent 173997c commit 4c917a3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 13 deletions.
9 changes: 1 addition & 8 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,7 @@ func main() {
// every day execution

err := cron2.AddFunc("0/5 * * * * *", func() {
if service.ClientCount > 0 {
// route.SendNetINfoBySocket()
// route.SendCPUBySocket()
// route.SendMemBySocket()
// route.SendDiskBySocket()
// route.SendUSBBySocket()
route.SendAllHardwareStatusBySocket()
}
route.SendAllHardwareStatusBySocket()
})
if err != nil {
fmt.Println(err)
Expand Down
6 changes: 1 addition & 5 deletions service/notify.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@ import (
"gorm.io/gorm"
)

var (
//NotifyMsg chan notify.Message
ClientCount int
)

type NotifyServer interface {
GetLog(id string) model.AppNotify
AddLog(log model.AppNotify)
Expand Down Expand Up @@ -64,6 +59,7 @@ func (i *notifyServer) SendNotify(name string, message map[string]interface{}) {
response, err := MyService.MessageBus().PublishEventWithResponse(context.Background(), common.SERVICENAME, name, msg)
if err != nil {
logger.Error("failed to publish event to message bus", zap.Error(err), zap.Any("event", msg))
return
}
if response.StatusCode() != http.StatusOK {
logger.Error("failed to publish event to message bus", zap.String("status", response.Status()), zap.Any("response", response))
Expand Down

0 comments on commit 4c917a3

Please sign in to comment.