This commit is contained in:
aozhiwei 2024-06-05 13:59:43 +08:00
parent 1af2fc3fa0
commit 1a7fb61f1c

View File

@ -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)
}
})
}