mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-10-29 15:42:24 -05:00
some variable renaming, for ease of following
This commit is contained in:
parent
e99d0d7276
commit
791d7c5aef
1 changed files with 12 additions and 12 deletions
24
internal/cache/timeline/status.go
vendored
24
internal/cache/timeline/status.go
vendored
|
|
@ -361,9 +361,9 @@ func (t *StatusTimeline) Load(
|
||||||
// Get paging details.
|
// Get paging details.
|
||||||
lo := page.Min.Value
|
lo := page.Min.Value
|
||||||
hi := page.Max.Value
|
hi := page.Max.Value
|
||||||
lim := page.Limit
|
limit := page.Limit
|
||||||
ord := page.Order()
|
order := page.Order()
|
||||||
dir := toDirection(ord)
|
dir := toDirection(order)
|
||||||
|
|
||||||
// Use a copy of current page so
|
// Use a copy of current page so
|
||||||
// we can repeatedly update it.
|
// we can repeatedly update it.
|
||||||
|
|
@ -378,7 +378,7 @@ func (t *StatusTimeline) Load(
|
||||||
metas := t.cache.Select(
|
metas := t.cache.Select(
|
||||||
util.PtrIf(lo),
|
util.PtrIf(lo),
|
||||||
util.PtrIf(hi),
|
util.PtrIf(hi),
|
||||||
util.PtrIf(lim),
|
util.PtrIf(limit),
|
||||||
dir,
|
dir,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -403,7 +403,7 @@ func (t *StatusTimeline) Load(
|
||||||
nextPageParams(nextPg,
|
nextPageParams(nextPg,
|
||||||
metas[len(metas)-1].ID,
|
metas[len(metas)-1].ID,
|
||||||
metas[0].ID,
|
metas[0].ID,
|
||||||
ord,
|
order,
|
||||||
)
|
)
|
||||||
|
|
||||||
// Before any further loading,
|
// Before any further loading,
|
||||||
|
|
@ -428,7 +428,7 @@ func (t *StatusTimeline) Load(
|
||||||
var justLoaded []*StatusMeta
|
var justLoaded []*StatusMeta
|
||||||
|
|
||||||
// Check whether loaded enough from cache.
|
// Check whether loaded enough from cache.
|
||||||
if need := lim - len(metas); need > 0 {
|
if need := limit - len(metas); need > 0 {
|
||||||
|
|
||||||
// Perform a maximum of 5
|
// Perform a maximum of 5
|
||||||
// load attempts fetching
|
// load attempts fetching
|
||||||
|
|
@ -452,7 +452,7 @@ func (t *StatusTimeline) Load(
|
||||||
nextPageParams(nextPg,
|
nextPageParams(nextPg,
|
||||||
statuses[len(statuses)-1].ID,
|
statuses[len(statuses)-1].ID,
|
||||||
statuses[0].ID,
|
statuses[0].ID,
|
||||||
ord,
|
order,
|
||||||
)
|
)
|
||||||
|
|
||||||
// Perform any pre-filtering on newly loaded statuses.
|
// Perform any pre-filtering on newly loaded statuses.
|
||||||
|
|
@ -486,7 +486,7 @@ func (t *StatusTimeline) Load(
|
||||||
|
|
||||||
// Check if we reached
|
// Check if we reached
|
||||||
// requested page limit.
|
// requested page limit.
|
||||||
if len(metas) >= lim {
|
if len(metas) >= limit {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -496,21 +496,21 @@ func (t *StatusTimeline) Load(
|
||||||
var apiStatuses []*apimodel.Status
|
var apiStatuses []*apimodel.Status
|
||||||
if len(metas) > 0 {
|
if len(metas) > 0 {
|
||||||
switch {
|
switch {
|
||||||
case len(metas) <= lim:
|
case len(metas) <= limit:
|
||||||
// We have under
|
// We have under
|
||||||
// expected limit.
|
// expected limit.
|
||||||
|
|
||||||
case ord.Ascending():
|
case order.Ascending():
|
||||||
// Ascending order was requested
|
// Ascending order was requested
|
||||||
// and we have more than limit, so
|
// and we have more than limit, so
|
||||||
// trim extra metadata from end.
|
// trim extra metadata from end.
|
||||||
metas = metas[:lim]
|
metas = metas[:limit]
|
||||||
|
|
||||||
default: /* i.e. descending */
|
default: /* i.e. descending */
|
||||||
// Descending order was requested
|
// Descending order was requested
|
||||||
// and we have more than limit, so
|
// and we have more than limit, so
|
||||||
// trim extra metadata from start.
|
// trim extra metadata from start.
|
||||||
metas = metas[len(metas)-lim:]
|
metas = metas[len(metas)-limit:]
|
||||||
}
|
}
|
||||||
|
|
||||||
// Using meta and funcs, prepare frontend API models.
|
// Using meta and funcs, prepare frontend API models.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue