mirror of
https://github.com/tulir/gomuks.git
synced 2025-04-20 18:43:41 -05:00
hicli/init: add safety for too many empty rooms
This commit is contained in:
parent
e8c8a44f38
commit
2c489fa582
1 changed files with 4 additions and 1 deletions
|
@ -120,8 +120,11 @@ func (h *HiClient) GetInitialSync(ctx context.Context, batchSize int) iter.Seq[*
|
||||||
payload := SyncComplete{
|
payload := SyncComplete{
|
||||||
Rooms: make(map[id.RoomID]*SyncRoom, len(rooms)),
|
Rooms: make(map[id.RoomID]*SyncRoom, len(rooms)),
|
||||||
}
|
}
|
||||||
for _, room := range rooms {
|
for roomIdx, room := range rooms {
|
||||||
if room.SortingTimestamp == rooms[len(rooms)-1].SortingTimestamp {
|
if room.SortingTimestamp == rooms[len(rooms)-1].SortingTimestamp {
|
||||||
|
if roomIdx == 0 {
|
||||||
|
batchSize *= 2
|
||||||
|
}
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
maxTS = room.SortingTimestamp.Time
|
maxTS = room.SortingTimestamp.Time
|
||||||
|
|
Loading…
Add table
Reference in a new issue