feat: incr sync version.
This commit is contained in:
parent
f2e8bc1275
commit
0022956643
@ -82,9 +82,9 @@ func (c *Conversation) doNotificationNew(c2v common.Cmd2Value) {
|
|||||||
err := syncFunc(ctx)
|
err := syncFunc(ctx)
|
||||||
duration := time.Since(startTime)
|
duration := time.Since(startTime)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.ZWarn(ctx, fmt.Sprintf("%s sync err", funcName), err, "duration", duration)
|
log.ZWarn(ctx, fmt.Sprintf("%s sync err", funcName), err, "duration", duration.Seconds())
|
||||||
} else {
|
} else {
|
||||||
log.ZDebug(ctx, fmt.Sprintf("%s completed successfully", funcName), "duration", duration)
|
log.ZDebug(ctx, fmt.Sprintf("%s completed successfully", funcName), "duration", duration.Seconds())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case constant.MsgSyncFailed:
|
case constant.MsgSyncFailed:
|
||||||
|
@ -16,6 +16,8 @@ package group
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"github.com/openimsdk/tools/errs"
|
||||||
|
"gorm.io/gorm"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/openimsdk/tools/utils/datautil"
|
"github.com/openimsdk/tools/utils/datautil"
|
||||||
@ -271,6 +273,13 @@ func (g *Group) GetSpecifiedGroupMembersInfo(ctx context.Context, groupID string
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (g *Group) GetGroupMemberList(ctx context.Context, groupID string, filter, offset, count int32) ([]*model_struct.LocalGroupMember, error) {
|
func (g *Group) GetGroupMemberList(ctx context.Context, groupID string, filter, offset, count int32) ([]*model_struct.LocalGroupMember, error) {
|
||||||
|
_, err := g.db.GetVersionSync(ctx, g.groupAndMemberVersionTableName(), groupID)
|
||||||
|
if errs.Unwrap(err) == gorm.ErrRecordNotFound {
|
||||||
|
err := g.IncrSyncGroupAndMember(ctx, groupID)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
dataFetcher := datafetcher.NewDataFetcher(
|
dataFetcher := datafetcher.NewDataFetcher(
|
||||||
g.db,
|
g.db,
|
||||||
g.groupAndMemberVersionTableName(),
|
g.groupAndMemberVersionTableName(),
|
||||||
|
@ -496,7 +496,6 @@ func (c *LongConnMgr) reConn(ctx context.Context, num *int) (needRecon bool, err
|
|||||||
}
|
}
|
||||||
c.connWrite.Lock()
|
c.connWrite.Lock()
|
||||||
defer c.connWrite.Unlock()
|
defer c.connWrite.Unlock()
|
||||||
log.ZDebug(ctx, "conn start")
|
|
||||||
c.listener.OnConnecting()
|
c.listener.OnConnecting()
|
||||||
c.SetConnectionStatus(Connecting)
|
c.SetConnectionStatus(Connecting)
|
||||||
url := fmt.Sprintf("%s?sendID=%s&token=%s&platformID=%d&operationID=%s&isBackground=%t",
|
url := fmt.Sprintf("%s?sendID=%s&token=%s&platformID=%d&operationID=%s&isBackground=%t",
|
||||||
@ -505,6 +504,7 @@ func (c *LongConnMgr) reConn(ctx context.Context, num *int) (needRecon bool, err
|
|||||||
if c.IsCompression {
|
if c.IsCompression {
|
||||||
url += fmt.Sprintf("&compression=%s", "gzip")
|
url += fmt.Sprintf("&compression=%s", "gzip")
|
||||||
}
|
}
|
||||||
|
log.ZDebug(ctx, "conn start", "url", url)
|
||||||
resp, err := c.conn.Dial(url, nil)
|
resp, err := c.conn.Dial(url, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.SetConnectionStatus(Closed)
|
c.SetConnectionStatus(Closed)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user