refactor(all): refactor code

remove redundant code and some code refactor
This commit is contained in:
yaziming
2019-10-11 16:01:57 +08:00
parent e5d228c980
commit 2f6b517356
27 changed files with 155 additions and 161 deletions

View File

@@ -2,6 +2,7 @@ package msg_handler
import (
"crawlab/constants"
"crawlab/database"
"crawlab/entity"
"crawlab/model"
"crawlab/utils"
@@ -39,7 +40,7 @@ func (g *Log) get() error {
msgSd.Log = utils.BytesToString(logStr)
}
// 发布消息给主节点
if err := utils.Pub(constants.ChannelMasterNode, msgSd); err != nil {
if err := database.Pub(constants.ChannelMasterNode, msgSd); err != nil {
return err
}
return nil

View File

@@ -2,9 +2,9 @@ package msg_handler
import (
"crawlab/constants"
"crawlab/database"
"crawlab/entity"
"crawlab/model"
"crawlab/utils"
)
type SystemInfo struct {
@@ -22,7 +22,7 @@ func (s *SystemInfo) Handle() error {
NodeId: s.msg.NodeId,
SysInfo: sysInfo,
}
if err := utils.Pub(constants.ChannelMasterNode, msgSd); err != nil {
if err := database.Pub(constants.ChannelMasterNode, msgSd); err != nil {
return err
}
return nil