Add some more tracing and logging

This commit is contained in:
Till Faelligen 2023-09-07 09:09:16 +02:00
parent f3e07c529b
commit 3510682b58
No known key found for this signature in database
GPG Key ID: ACCDC9606D472758
2 changed files with 6 additions and 0 deletions

View File

@ -308,6 +308,8 @@ func (c *UserCache) OnRegistered(ctx context.Context) error {
// Load timelines from the database. Uses cached UserRoomData for metadata purposes only.
func (c *UserCache) LazyLoadTimelines(ctx context.Context, loadPos int64, roomIDs []string, maxTimelineEvents int) map[string]UserRoomData {
_, span := internal.StartSpan(ctx, "LazyLoadTimelines")
defer span.End()
if c.LazyRoomDataOverride != nil {
return c.LazyRoomDataOverride(loadPos, roomIDs, maxTimelineEvents)
}
@ -408,6 +410,8 @@ func (c *UserCache) Invites() map[string]UserRoomData {
// which would cause the transaction ID to be missing from the event. Instead, we always look for txn
// IDs in the v2 poller, and then set them appropriately at request time.
func (c *UserCache) AnnotateWithTransactionIDs(ctx context.Context, userID string, deviceID string, roomIDToEvents map[string][]json.RawMessage) map[string][]json.RawMessage {
_, span := internal.StartSpan(ctx, "AnnotateWithTransactionIDs")
defer span.End()
var eventIDs []string
eventIDToEvent := make(map[string]struct {
roomID string

View File

@ -591,6 +591,8 @@ func (s *ConnState) getInitialRoomData(ctx context.Context, roomSub sync3.RoomSu
roomToTimeline = s.userCache.AnnotateWithTransactionIDs(ctx, s.userID, s.deviceID, roomToTimeline)
rsm := roomSub.RequiredStateMap(s.userID)
internal.Logf(ctx, "connstate", "getInitialRoomData for %d rooms, RequiredStateMap: %#v", len(roomIDs), rsm)
// Filter out rooms we are only invited to, as we don't need to fetch the state
// since we'll be using the invite_state only.
loadRoomIDs := make([]string, 0, len(roomIDs))