1
This commit is contained in:
parent
9f395295f0
commit
08e7eddaa5
@ -22,6 +22,7 @@ type mailMgr struct {
|
|||||||
personalMails sync.Map //string => sync.Map<int64, *mail>
|
personalMails sync.Map //string => sync.Map<int64, *mail>
|
||||||
groupHash sync.Map //int64 => *userGroup
|
groupHash sync.Map //int64 => *userGroup
|
||||||
lastSyncEventIdx int64
|
lastSyncEventIdx int64
|
||||||
|
pullingEvent bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *mailMgr) Init() {
|
func (this *mailMgr) Init() {
|
||||||
@ -283,4 +284,30 @@ func (this *mailMgr) syncEvent() {
|
|||||||
panic("sync event error")
|
panic("sync event error")
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
f5.GetTimer().SetInterval(
|
||||||
|
1000 * 2,
|
||||||
|
func (e int32, args *q5.Args) {
|
||||||
|
if e == q5.TIMER_EXEC_EVENT {
|
||||||
|
this.pullEvent()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *mailMgr) pullEvent() {
|
||||||
|
if this.pullingEvent {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.pullingEvent = true
|
||||||
|
f5.GetJsStyleDb().SyncSelectCustomQuery(
|
||||||
|
constant.MAIL_DB,
|
||||||
|
fmt.Sprintf("SELECT * FROM t_event WHERE idx > %d;", this.lastSyncEventIdx),
|
||||||
|
func(err error, ds *f5.DataSet) {
|
||||||
|
this.pullingEvent = false
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
for ds.Next() {
|
||||||
|
this.lastSyncEventIdx = q5.ToInt64(ds.GetByName("idx"))
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user