mirror of
https://github.com/matrix-org/sliding-sync.git
synced 2025-03-10 13:37:11 +00:00
lists_test: add timestamps to RoomConnMetadata
This commit is contained in:
parent
d8f158b292
commit
5f3c9dff3c
@ -156,6 +156,18 @@ func (s *InternalRequestLists) Get(listKey string) *FilteredSortableRooms {
|
|||||||
return s.lists[listKey]
|
return s.lists[listKey]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ListKeys returns a copy of the list keys currently tracked by this
|
||||||
|
// InternalRequestLists struct, in no particular order. Outside of test code, you
|
||||||
|
// probably don't want to call this---you probably have the set of list keys tracked
|
||||||
|
// elsewhere in the application.
|
||||||
|
func (s *InternalRequestLists) ListKeys() []string {
|
||||||
|
keys := make([]string, len(s.lists))
|
||||||
|
for listKey, _ := range s.lists {
|
||||||
|
keys = append(keys, listKey)
|
||||||
|
}
|
||||||
|
return keys
|
||||||
|
}
|
||||||
|
|
||||||
// ListsByVisibleRoomIDs builds a map from room IDs to a slice of list names. Keys are
|
// ListsByVisibleRoomIDs builds a map from room IDs to a slice of list names. Keys are
|
||||||
// all room IDs that are currently visible in at least one sliding window. Values are
|
// all room IDs that are currently visible in at least one sliding window. Values are
|
||||||
// the names of all lists (in no particular order) in which the given room ID is
|
// the names of all lists (in no particular order) in which the given room ID is
|
||||||
|
@ -31,6 +31,10 @@ func addRooms(list *sync3.InternalRequestLists, n int) {
|
|||||||
for i := 0; i < n; i++ {
|
for i := 0; i < n; i++ {
|
||||||
next := roomCounter.Add(1)
|
next := roomCounter.Add(1)
|
||||||
messageTimestamp := uint64(timestamp.Add(time.Duration(next) * time.Minute).UnixMilli())
|
messageTimestamp := uint64(timestamp.Add(time.Duration(next) * time.Minute).UnixMilli())
|
||||||
|
lastInterestedEventTimestamps := make(map[string]uint64)
|
||||||
|
for _, listKey := range list.ListKeys() {
|
||||||
|
lastInterestedEventTimestamps[listKey] = messageTimestamp
|
||||||
|
}
|
||||||
list.SetRoom(sync3.RoomConnMetadata{
|
list.SetRoom(sync3.RoomConnMetadata{
|
||||||
RoomMetadata: internal.RoomMetadata{
|
RoomMetadata: internal.RoomMetadata{
|
||||||
RoomID: fmt.Sprintf("!%d:benchmark", next),
|
RoomID: fmt.Sprintf("!%d:benchmark", next),
|
||||||
@ -41,7 +45,7 @@ func addRooms(list *sync3.InternalRequestLists, n int) {
|
|||||||
UserRoomData: caches.UserRoomData{
|
UserRoomData: caches.UserRoomData{
|
||||||
IsDM: next%10 == 0,
|
IsDM: next%10 == 0,
|
||||||
},
|
},
|
||||||
LastInterestedEventTimestamps: make(map[string]uint64),
|
LastInterestedEventTimestamps: lastInterestedEventTimestamps,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user