perf(cache): fix slice capacity under-allocation in SetUserOnline (#3746)

This commit is contained in:
buvidk1234 2026-06-26 15:04:47 +08:00 committed by GitHub
parent 1036e81eb4
commit 30074d16ae
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -112,7 +112,7 @@ func (s *userOnline) SetUserOnline(ctx context.Context, userID string, online, o
end
`
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)))
for _, platformID := range offline {
argv = append(argv, platformID)