Skip to content

Commit

Permalink
Merge branch 'openimsdk:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
icey-yu authored Jul 10, 2024
2 parents 1e50864 + 213613c commit 8b74c4f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 17 deletions.
2 changes: 1 addition & 1 deletion config/log.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Log storage path, default is acceptable, change to a full path if modification is needed
storageLocation: ../../../../logs/
# Log rotation period (in hours), default is acceptable
rotationTime: 1
rotationTime: 24
# Maximum size of each log file (in MB), default is acceptable, it means unlimited
maxSize: 0
# Number of log files to retain, default is acceptable, it means whenever the log file is rotated, the old log file will be deleted
Expand Down
16 changes: 2 additions & 14 deletions pkg/common/storage/controller/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ func (a *authDatabase) SetTokenMapByUidPid(ctx context.Context, userID string, p

// Create Token.
func (a *authDatabase) CreateToken(ctx context.Context, userID string, platformID int) (string, error) {
isCreate := true // flag is create or update
tokens, err := a.cache.GetTokensWithoutError(ctx, userID, platformID)
if err != nil {
return "", err
Expand All @@ -66,9 +65,6 @@ func (a *authDatabase) CreateToken(ctx context.Context, userID string, platformI
if err != nil || v != constant.NormalToken {
deleteTokenKey = append(deleteTokenKey, k)
}
if v == constant.NormalToken {
isCreate = false
}
}
if len(deleteTokenKey) != 0 {
err = a.cache.DeleteTokenByUidPid(ctx, userID, platformID, deleteTokenKey)
Expand All @@ -84,16 +80,8 @@ func (a *authDatabase) CreateToken(ctx context.Context, userID string, platformI
return "", errs.WrapMsg(err, "token.SignedString")
}

if isCreate {
// should create,should specify expiration time
if err = a.cache.SetTokenFlagEx(ctx, userID, platformID, tokenString, constant.NormalToken); err != nil {
return "", err
}
} else {
// should update
if err = a.cache.SetTokenFlag(ctx, userID, platformID, tokenString, constant.NormalToken); err != nil {
return "", err
}
if err = a.cache.SetTokenFlagEx(ctx, userID, platformID, tokenString, constant.NormalToken); err != nil {
return "", err
}
return tokenString, nil
}
4 changes: 2 additions & 2 deletions pkg/common/storage/database/mgo/msg.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ package mgo
import (
"context"
"fmt"
"time"

"github.com/openimsdk/open-im-server/v3/pkg/common/storage/database"
"github.com/openimsdk/open-im-server/v3/pkg/common/storage/model"
"github.com/openimsdk/tools/utils/datautil"
"time"

"github.com/openimsdk/protocol/constant"
"github.com/openimsdk/protocol/msg"
Expand Down Expand Up @@ -358,7 +359,6 @@ func (m *MsgMgo) SearchMessage(ctx context.Context, req *msg.SearchMessageReq) (
msgInfo.Msg.ContentType = constant.MsgRevokeNotification
msgInfo.Msg.Content = string(content)
}
msgs = append(msgs, msgInfo)
}
//start := (req.Pagination.PageNumber - 1) * req.Pagination.ShowNumber
//n := int32(len(msgs))
Expand Down

0 comments on commit 8b74c4f

Please sign in to comment.