Remove debug and improve comments

This commit is contained in:
David Robertson 2023-09-12 16:22:11 +01:00
parent 0bc33f3451
commit 0d4e8c6df9
No known key found for this signature in database
GPG Key ID: 903ECE108A39DEDD
5 changed files with 10 additions and 7 deletions

View File

@ -318,8 +318,11 @@ func (a *Accumulator) Initialise(roomID string, state []json.RawMessage) (Initia
}
type AccumulateResult struct {
// TODO: is this redundant---identical to len(TimelineNIDs)?
NumNew int
// NumNew is the number of events in timeline NIDs that were not previously known
// to the proyx.
NumNew int
// TimelineNIDs is the list of event nids seen in a sync v2 timeline. Some of these
// may already be known to the proxy.
TimelineNIDs []int64
// RequiresReload is set to true when we have accumulated a non-incremental state
// change (typically a redaction) that requires consumers to reload the room state

View File

@ -301,7 +301,7 @@ func (h *Handler) Accumulate(ctx context.Context, userID, deviceID, roomID, prev
return err
}
// TODO: does the ordering of this versus V2Accumulate matter here?
// Consumers should reload state before processing new timeline events.
if accResult.RequiresReload {
h.v2Pub.Notify(pubsub.ChanV2, &pubsub.V2InvalidateRoom{
RoomID: roomID,

View File

@ -396,11 +396,9 @@ func (c *GlobalCache) OnInvalidateRoom(ctx context.Context, roomID string) {
return
}
logger.Warn().Any("before", metadata).Msgf("DMR: invalidate GLOBALLLLLL room %s", roomID)
err := c.store.ResetMetadataState(metadata)
if err != nil {
internal.GetSentryHubFromContextOrDefault(ctx).CaptureException(err)
logger.Warn().Err(err).Msg("OnInvalidateRoom: failed to reset metadata")
}
logger.Warn().Any("after", metadata).Msgf("DMR: invalidate GLOBALLLLLL room %s", roomID)
}

View File

@ -752,5 +752,8 @@ func (u *UserCache) ShouldIgnore(userID string) bool {
}
func (u *UserCache) OnInvalidateRoom(ctx context.Context, roomID string) {
logger.Warn().Msgf("DMR: invalidate USERRRRRRR room %s", roomID)
// Nothing for now. In UserRoomData the fields dependant on room state are
// IsDM, IsInvite, HasLeft, Invite, CanonicalisedName, ResolvedAvatarURL, Spaces.
// Not clear to me if we need to reload these or if we will inherit any changes from
// the global cache.
}

View File

@ -806,7 +806,6 @@ func (h *SyncLiveHandler) OnInvalidateRoom(p *pubsub.V2InvalidateRoom) {
ctx, task := internal.StartTask(context.Background(), "OnInvalidateRoom")
defer task.End()
logger.Warn().Msgf("DMR: invalidate room %s", p.RoomID)
h.GlobalCache.OnInvalidateRoom(ctx, p.RoomID)
h.Dispatcher.OnInvalidateRoom(ctx, p.RoomID)
}