mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-07 15:03:09 -06:00
Make 100 a const
This commit is contained in:
parent
6ddfa4441c
commit
0f15c6bf90
|
|
@ -90,6 +90,10 @@ type PerformBackfillRequest struct {
|
||||||
VirtualHost spec.ServerName `json:"virtual_host"`
|
VirtualHost spec.ServerName `json:"virtual_host"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// limitPrevEventIDs is the maximum of eventIDs we
|
||||||
|
// return when calling PrevEventIDs.
|
||||||
|
const limitPrevEventIDs = 100
|
||||||
|
|
||||||
// PrevEventIDs returns the prev_event IDs of either 100 backwards extremities or
|
// PrevEventIDs returns the prev_event IDs of either 100 backwards extremities or
|
||||||
// len(r.BackwardsExtremities). Limited to 100, due to Synapse/Dendrite stopping after reaching
|
// len(r.BackwardsExtremities). Limited to 100, due to Synapse/Dendrite stopping after reaching
|
||||||
// this limit. (which sounds sane)
|
// this limit. (which sounds sane)
|
||||||
|
|
@ -98,8 +102,8 @@ func (r *PerformBackfillRequest) PrevEventIDs() []string {
|
||||||
|
|
||||||
// Create a unique eventID map of either 100 or len(r.BackwardsExtremities).
|
// Create a unique eventID map of either 100 or len(r.BackwardsExtremities).
|
||||||
// 100 since Synapse/Dendrite stops after reaching 100 events.
|
// 100 since Synapse/Dendrite stops after reaching 100 events.
|
||||||
if len(r.BackwardsExtremities) > 100 {
|
if len(r.BackwardsExtremities) > limitPrevEventIDs {
|
||||||
uniqueIDs = make(map[string]struct{}, 100)
|
uniqueIDs = make(map[string]struct{}, limitPrevEventIDs)
|
||||||
} else {
|
} else {
|
||||||
uniqueIDs = make(map[string]struct{}, len(r.BackwardsExtremities))
|
uniqueIDs = make(map[string]struct{}, len(r.BackwardsExtremities))
|
||||||
}
|
}
|
||||||
|
|
@ -109,7 +113,7 @@ outerLoop:
|
||||||
for _, evID := range pes {
|
for _, evID := range pes {
|
||||||
uniqueIDs[evID] = struct{}{}
|
uniqueIDs[evID] = struct{}{}
|
||||||
// We found enough unique eventIDs.
|
// We found enough unique eventIDs.
|
||||||
if len(uniqueIDs) >= 100 {
|
if len(uniqueIDs) >= limitPrevEventIDs {
|
||||||
break outerLoop
|
break outerLoop
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue