Bugfixerino (#133)

* fix some lil bugs

* fmt, lint
This commit is contained in:
Tobi Smethurst 2021-08-10 16:56:59 +02:00 committed by GitHub
commit 6acd410426
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 62 additions and 24 deletions

View file

@ -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 {