mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-07-14 01:54:26 +08:00
perf(cache): fix slice capacity under-allocation in SetUserOnline (#3746)
This commit is contained in:
parent
1036e81eb4
commit
30074d16ae
2
pkg/common/storage/cache/redis/online.go
vendored
2
pkg/common/storage/cache/redis/online.go
vendored
@ -112,7 +112,7 @@ func (s *userOnline) SetUserOnline(ctx context.Context, userID string, online, o
|
|||||||
end
|
end
|
||||||
`
|
`
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
argv := make([]any, 0, 2+len(online)+len(offline))
|
argv := make([]any, 0, 4+len(online)+len(offline))
|
||||||
argv = append(argv, int32(s.expire/time.Second), now.Unix(), now.Add(s.expire).Unix(), int32(len(offline)))
|
argv = append(argv, int32(s.expire/time.Second), now.Unix(), now.Add(s.expire).Unix(), int32(len(offline)))
|
||||||
for _, platformID := range offline {
|
for _, platformID := range offline {
|
||||||
argv = append(argv, platformID)
|
argv = append(argv, platformID)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user