aa
This commit is contained in:
@@ -142,6 +142,8 @@ func ListenTcp() {
|
||||
globals.SugarLogger.Debugf("begin listenTcp port 8000......")
|
||||
go HandleTcpMessages()
|
||||
go HandleCheckTcpHeart()
|
||||
go doPrint(printMsgChanFail)
|
||||
go doPrint2(printMsgChan)
|
||||
for {
|
||||
c, err := l.Accept()
|
||||
if err != nil {
|
||||
@@ -272,7 +274,8 @@ func doPrint(printMsgChanFail chan *model.PrintMsg) (err error) {
|
||||
db = dao.GetDB()
|
||||
)
|
||||
for {
|
||||
printMsg := <-printMsgChanFail
|
||||
select {
|
||||
case printMsg, _ := <-printMsgChanFail:
|
||||
var (
|
||||
data []byte
|
||||
c net.Conn
|
||||
@@ -303,6 +306,7 @@ func doPrint(printMsgChanFail chan *model.PrintMsg) (err error) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func printStatus2JxStatus(printStatus string) (status int) {
|
||||
@@ -359,7 +363,6 @@ func HandleTcpMessages() {
|
||||
)
|
||||
for {
|
||||
//一直读?
|
||||
time.Sleep(time.Second / 2)
|
||||
prints, _ := dao.GetPrintMsgs(db, []int{printMsgWait}, time.Now().Add(-time.Hour*3), time.Now(), offset, pageSize)
|
||||
for _, printMsg := range prints {
|
||||
printMsgChan <- printMsg
|
||||
@@ -372,7 +375,8 @@ func doPrint2(printMsgChan chan *model.PrintMsg) (err error) {
|
||||
db = dao.GetDB()
|
||||
)
|
||||
for {
|
||||
printMsg := <-printMsgChan
|
||||
select {
|
||||
case printMsg, _ := <-printMsgChan:
|
||||
var (
|
||||
data []byte
|
||||
c net.Conn
|
||||
@@ -419,6 +423,7 @@ func doPrint2(printMsgChan chan *model.PrintMsg) (err error) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func HandleCheckTcpHeart() {
|
||||
|
||||
Reference in New Issue
Block a user