This commit is contained in:
aozhiwei 2024-03-24 09:45:04 +08:00
parent 99637e8437
commit fb3b8a273e
2 changed files with 32 additions and 2 deletions

View File

@ -2,6 +2,9 @@ package friend
import (
"q5"
"f5"
"fmt"
"main/constant"
)
type friendMgr struct {
@ -26,7 +29,34 @@ func (this *friendMgr) loadFromDB() {
}
func (this *friendMgr) loadFriendships() {
var lastIdx int64
f5.GetSysLog().Info("friendMgr.loadFriendships begin")
var done = false
for !done {
f5.GetJsStyleDb().SyncSelectCustomQuery(
constant.FRIEND_DB,
fmt.Sprintf("SELECT * FROM t_friend_relationship WHERE idx > %d AND deleted = 0", lastIdx),
func (err error, ds *f5.DataSet) {
if err != nil {
panic(fmt.Sprintf("friendMgr.loadFriendships dberror:%s", err))
}
for ds.Next() {
idx := q5.ToInt64(ds.GetByName("idx"))
if idx > lastIdx {
lastIdx = idx
} else {
panic(fmt.Sprintf("friendMgr.loadFriendships idxerror:%s %s", idx, lastIdx))
}
}
if ds.NumOfReaded() <= 0 {
done = true
}
})
}
f5.GetSysLog().Info("friendMgr.loadFriendships end lastIdx:%s friendNum:%d blackNum:%d",
lastIdx,
len(this.friendHash),
len(this.blackHash))
}
func (this *friendMgr) loadBlacklist() {

2
third_party/f5 vendored

@ -1 +1 @@
Subproject commit a149beea0673c64907f3d9e64153137aad52f790
Subproject commit 35f839e5d4f3ef46a050c1968c16554ddb41c25e