1
This commit is contained in:
58
business/jxstore/event/timing_task.go
Normal file
58
business/jxstore/event/timing_task.go
Normal file
@@ -0,0 +1,58 @@
|
||||
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
|
||||
//}
|
||||
Reference in New Issue
Block a user