Skip to content

CasaOS - A simple, easy-to-use, elegant open-source Personal Cloud system.

Remove client judgment (#862)

link4c917a33a41b
diff --git a/main.go b/main.go
index ed1a83c..fe7bc98 100644
--- a/main.go
+++ b/main.go
@@ -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)
diff --git a/service/notify.go b/service/notify.go
index 7276c45..8df6e51 100644
--- a/service/notify.go
+++ b/service/notify.go
@@ -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)
@@ -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))