mirror of
https://github.com/matrix-org/sliding-sync.git
synced 2025-03-10 13:37:11 +00:00
Improve logging for the prependStateEvents message
This commit is contained in:
parent
e5ee4ef855
commit
8c73667df8
@ -533,15 +533,15 @@ func (p *poller) poll(ctx context.Context, s *pollLoopState) error {
|
||||
p.initialToDeviceOnly = false
|
||||
start = time.Now()
|
||||
s.failCount = 0
|
||||
|
||||
wasInitial := s.since == ""
|
||||
wasFirst := s.firstTime
|
||||
// Do the most latency-sensitive parsing first.
|
||||
// This only helps if the executor isn't already busy.
|
||||
p.parseToDeviceMessages(ctx, resp)
|
||||
p.parseE2EEData(ctx, resp)
|
||||
p.parseGlobalAccountData(ctx, resp)
|
||||
p.parseRoomsResponse(ctx, resp)
|
||||
|
||||
wasInitial := s.since == ""
|
||||
wasFirst := s.firstTime
|
||||
p.parseRoomsResponse(ctx, resp, wasInitial)
|
||||
|
||||
s.since = resp.NextBatch
|
||||
// persist the since token (TODO: this could get slow if we hammer the DB too much)
|
||||
@ -646,7 +646,7 @@ func (p *poller) parseGlobalAccountData(ctx context.Context, res *SyncResponse)
|
||||
p.receiver.OnAccountData(ctx, p.userID, AccountDataGlobalRoom, res.AccountData.Events)
|
||||
}
|
||||
|
||||
func (p *poller) parseRoomsResponse(ctx context.Context, res *SyncResponse) {
|
||||
func (p *poller) parseRoomsResponse(ctx context.Context, res *SyncResponse, wasInitial bool) {
|
||||
ctx, task := internal.StartTask(ctx, "parseRoomsResponse")
|
||||
defer task.End()
|
||||
stateCalls := 0
|
||||
@ -664,12 +664,21 @@ func (p *poller) parseRoomsResponse(ctx context.Context, res *SyncResponse) {
|
||||
// the timeline now so that future events are received under the
|
||||
// correct room state.
|
||||
const warnMsg = "parseRoomsResponse: prepending state events to timeline after gappy poll"
|
||||
logger.Warn().Str("room_id", roomID).Int("prependStateEvents", len(prependStateEvents)).Msg(warnMsg)
|
||||
logger.Warn().
|
||||
Str("room_id", roomID).
|
||||
Str("user_id", p.userID).
|
||||
Str("device_id", p.deviceID).
|
||||
Int("prependStateEvents", len(prependStateEvents)).
|
||||
Bool("initial", wasInitial).
|
||||
Msg(warnMsg)
|
||||
hub := internal.GetSentryHubFromContextOrDefault(ctx)
|
||||
hub.WithScope(func(scope *sentry.Scope) {
|
||||
scope.SetContext(internal.SentryCtxKey, map[string]interface{}{
|
||||
"room_id": roomID,
|
||||
"user_id": p.userID,
|
||||
"device_id": p.deviceID,
|
||||
"num_prepend_state_events": len(prependStateEvents),
|
||||
"initial": wasInitial,
|
||||
})
|
||||
hub.CaptureMessage(warnMsg)
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user