Files
jx-callback/business/jxstore/event/timing_task.go
邹宗楠 e15f83f913 1
2023-02-09 11:35:17 +08:00

59 lines
1.7 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package event
//
//import (
// "git.rosy.net.cn/baseapi/utils"
// "git.rosy.net.cn/jx-callback/business/model/dao"
// "git.rosy.net.cn/jx-callback/globals"
// "time"
//)
//
//func ScheduleTimerFuncByInterval(handler func(), delay, inerval time.Duration) {
// utils.AfterFuncWithRecover(delay, func() {
// beginTime := time.Now()
// handler()
// delay = inerval - time.Now().Sub(beginTime)
// if delay < time.Second {
// delay = time.Second
// }
// ScheduleTimerFuncByInterval(handler, delay, inerval)
// })
//}
//
//func (t *TcpClient) HandleTcpMessages2() {
// var (
// db = dao.GetDB()
// offset, pageSize = 0, 10
// )
//for printNo,have := range
// select {
// case <-t.TimeoutMap[printNo]:
// globals.SugarLogger.Debugf("HandleTcpMessages timeout")
// return
// default:
// //一直读?
// timeNow := time.Now()
// timeStart := time.Date(timeNow.Year(), timeNow.Month(), timeNow.Day(), 0, 0, 0, 0, timeNow.Location())
// timeEnd := time.Date(timeNow.Year(), timeNow.Month(), timeNow.Day(), 23, 59, 59, 0, timeNow.Location())
// prints, _ := dao.GetPrintMsgs(db, printNo, []int{printMsgWait}, timeStart, timeEnd, offset, pageSize)
// for _, printMsg := range prints {
// printMsg.Status = printMsgAlreadyLoad
// //先避免重复读再插到channel
// if _, err := dao.UpdateEntity(db, printMsg, "Status"); err == nil {
// if err = t.addMsgChan(printMsg); err != nil {
// globals.SugarLogger.Debugf("HandleTcpMessages addMsgChan Err: %v", err)
// }
// }
// }
// }
//}
//
//func (t *TcpClient) GetTimeOutMap() map[string]chan bool {
// t.RLock()
// defer t.RUnlock()
// if len(t.TimeoutMap) > 0 {
// return t.TimeoutMap
// }
// return nil
//}