fix: sync refresh complete self profile on session ready

This commit is contained in:
iamxvbaba 2026-08-02 19:32:17 +08:00
parent 2512eab51d
commit f67e87689c
8 changed files with 405 additions and 28 deletions

View file

@ -20,6 +20,7 @@ type captureSessions struct {
authKeyResolved bool
receives bool
receivesCalls int
sessionPushCalls int
messageType proto.MessageType
message bin.Encoder
userMessage bin.Encoder // 最近一次 PushToUser* 的消息(与 message 区分:message 也被 PushToSession 覆盖)
@ -33,30 +34,32 @@ type captureSessions struct {
}
type captureSessionsSnapshot struct {
sessionID int64
userID int64
userResolved bool
authKeyID [8]byte
authKeyResolved bool
receives bool
receivesCalls int
messageType proto.MessageType
message bin.Encoder
sessionID int64
userID int64
userResolved bool
authKeyID [8]byte
authKeyResolved bool
receives bool
receivesCalls int
sessionPushCalls int
messageType proto.MessageType
message bin.Encoder
}
func (s *captureSessions) snapshot() captureSessionsSnapshot {
s.mu.Lock()
defer s.mu.Unlock()
return captureSessionsSnapshot{
sessionID: s.sessionID,
userID: s.userID,
userResolved: s.userResolved,
authKeyID: s.authKeyID,
authKeyResolved: s.authKeyResolved,
receives: s.receives,
receivesCalls: s.receivesCalls,
messageType: s.messageType,
message: s.message,
sessionID: s.sessionID,
userID: s.userID,
userResolved: s.userResolved,
authKeyID: s.authKeyID,
authKeyResolved: s.authKeyResolved,
receives: s.receives,
receivesCalls: s.receivesCalls,
sessionPushCalls: s.sessionPushCalls,
messageType: s.messageType,
message: s.message,
}
}
@ -156,6 +159,7 @@ func (s *captureSessions) PushToSessionForAuthKey(_ context.Context, rawAuthKeyI
s.sessionID = sessionID
s.messageType = t
s.message = msg
s.sessionPushCalls++
return nil
}