diff --git a/server/adminserver/task/taskmgr.go b/server/adminserver/task/taskmgr.go index 9d3da2e1..bd6ebcf6 100644 --- a/server/adminserver/task/taskmgr.go +++ b/server/adminserver/task/taskmgr.go @@ -51,11 +51,16 @@ func (this *taskMgr) syncSysMail() { } } }() + lastOutTick := q5.GetTickCount() for true { this.pullSysMail() this.syncSysMailCond.L.Lock() this.syncSysMailCond.Wait() this.syncSysMailCond.L.Unlock() + if q5.GetTickCount() - lastOutTick > 15 { + lastOutTick = q5.GetTickCount() + f5.GetSysLog().Info("taskMgr lastSyncSysMailIdx:%s", this.lastSyncSysMailIdx) + } } } @@ -79,6 +84,9 @@ func (this *taskMgr) pullSysMail() { this.lastSyncSysMailIdx = idx } } + if ds.NumOfReaded() > 0 { + this.saveLastSyncSysMailIdx() + } }) } @@ -126,3 +134,24 @@ func (this *taskMgr) writeMail(ds *f5.DataSet) bool { }) return ok } + +func (this *taskMgr) saveLastSyncSysMailIdx() { + f5.GetGoStyleDb().Upsert( + constant.MAIL_DB, + "t_param", + [][]string{ + {"param_name", constant.PARAM_NAME_LAST_SYNC_SYS_MAIL_IDX}, + }, + [][]string{ + {"param_val1", q5.ToString(this.lastSyncSysMailIdx)}, + }, + [][]string { + {"param_name", constant.PARAM_NAME_LAST_SYNC_SYS_MAIL_IDX}, + {"param_val1", q5.ToString(this.lastSyncSysMailIdx)}, + }, + func (err error, lastInsertId int64, rowsAffected int64) { + if err != nil { + f5.GetSysLog().Info("saveLastSyncSysMailIdx err:%s", err) + } + }) +}