diff --git a/business/jxstore/event/event_tcp.go b/business/jxstore/event/event_tcp.go index f1512fd66..8917a5c5e 100644 --- a/business/jxstore/event/event_tcp.go +++ b/business/jxstore/event/event_tcp.go @@ -153,9 +153,9 @@ func (t *TcpClient) HandleTcpMessages(printNo string) { //一直读? prints, _ := dao.GetPrintMsgs(db, printNo, []int{printMsgWait}, time.Now().Add(-time.Hour*3), time.Now(), offset, pageSize) for _, printMsg := range prints { - t.addMsgChan(printMsg) printMsg.Status = printMsgAlreadyLoad dao.UpdateEntity(db, printMsg, "Status") + t.addMsgChan(printMsg) } } }() @@ -219,11 +219,13 @@ func (t *TcpClient) doPrint(key string) (err error) { return err } +//检测心跳 func (t *TcpClient) HandleCheckTcpHeart(key string) { go func() { for { if !utils.IsTimeZero(t.getPrintStatusTime(key)) { - if time.Now().Sub(t.getPrintStatusTime(key)) > time.Minute*3 { + //2分钟内没心跳判断打印机掉线了 + if time.Now().Sub(t.getPrintStatusTime(key)) > time.Minute*2 { changePrinterStatus(key, printerStatusOffline) if t.isExist(key) { globals.SugarLogger.Debugf("HandleCheckTcpHeart del key,%v", key)