summaryrefslogtreecommitdiff
path: root/internal/timeline/index.go
diff options
context:
space:
mode:
authorLibravatar Tobi Smethurst <31960611+tsmethurst@users.noreply.github.com>2021-08-10 16:56:59 +0200
committerLibravatar GitHub <noreply@github.com>2021-08-10 16:56:59 +0200
commit6acd410426f2f8941a0dbec4bfe07c2a94ce62b7 (patch)
treedbae658794d294c845640b9244b061cbbf11d94f /internal/timeline/index.go
parentroll back to sha256 for signatures (diff)
downloadgotosocial-6acd410426f2f8941a0dbec4bfe07c2a94ce62b7.tar.xz
Bugfixerino (#133)
* fix some lil bugs * fmt, lint
Diffstat (limited to 'internal/timeline/index.go')
-rw-r--r--internal/timeline/index.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/internal/timeline/index.go b/internal/timeline/index.go
index 8dd7fee97..c8894b284 100644
--- a/internal/timeline/index.go
+++ b/internal/timeline/index.go
@@ -39,8 +39,9 @@ func (t *timeline) IndexBefore(statusID string, include bool, amount int) error
filtered = append(filtered, s)
}
+ i := 0
grabloop:
- for len(filtered) < amount {
+ for ; len(filtered) < amount && i < 5; i = i + 1 { // try the grabloop 5 times only
statuses, err := t.db.GetHomeTimelineForAccount(t.accountID, "", offsetStatus, "", amount, false)
if err != nil {
if _, ok := err.(db.ErrNoEntries); ok {
@@ -74,8 +75,9 @@ func (t *timeline) IndexBehind(statusID string, amount int) error {
filtered := []*gtsmodel.Status{}
offsetStatus := statusID
+ i := 0
grabloop:
- for len(filtered) < amount {
+ for ; len(filtered) < amount && i < 5; i = i + 1 { // try the grabloop 5 times only
statuses, err := t.db.GetHomeTimelineForAccount(t.accountID, offsetStatus, "", "", amount, false)
if err != nil {
if _, ok := err.(db.ErrNoEntries); ok {