summaryrefslogtreecommitdiff
path: root/internal/timeline
diff options
context:
space:
mode:
Diffstat (limited to 'internal/timeline')
-rw-r--r--internal/timeline/index.go8
-rw-r--r--internal/timeline/index_test.go7
-rw-r--r--internal/timeline/manager_test.go10
-rw-r--r--internal/timeline/prepare.go6
4 files changed, 15 insertions, 16 deletions
diff --git a/internal/timeline/index.go b/internal/timeline/index.go
index 1e1a9d7bb..7cffe7ab9 100644
--- a/internal/timeline/index.go
+++ b/internal/timeline/index.go
@@ -50,9 +50,9 @@ func (t *timeline) IndexBefore(statusID string, include bool, amount int) error
i := 0
grabloop:
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)
+ statuses, err := t.db.GetHomeTimeline(t.accountID, "", "", offsetStatus, amount, false)
if err != nil {
- if _, ok := err.(db.ErrNoEntries); ok {
+ if err == db.ErrNoEntries {
break grabloop // we just don't have enough statuses left in the db so index what we've got and then bail
}
return fmt.Errorf("IndexBefore: error getting statuses from db: %s", err)
@@ -130,9 +130,9 @@ positionLoop:
grabloop:
for ; len(filtered) < amount && i < 5; i = i + 1 { // try the grabloop 5 times only
l.Tracef("entering grabloop; i is %d; len(filtered) is %d", i, len(filtered))
- statuses, err := t.db.GetHomeTimelineForAccount(t.accountID, offsetStatus, "", "", amount, false)
+ statuses, err := t.db.GetHomeTimeline(t.accountID, offsetStatus, "", "", amount, false)
if err != nil {
- if _, ok := err.(db.ErrNoEntries); ok {
+ if err == db.ErrNoEntries {
break grabloop // we just don't have enough statuses left in the db so index what we've got and then bail
}
return fmt.Errorf("IndexBehind: error getting statuses from db: %s", err)
diff --git a/internal/timeline/index_test.go b/internal/timeline/index_test.go
index f48b2691c..4201a27dd 100644
--- a/internal/timeline/index_test.go
+++ b/internal/timeline/index_test.go
@@ -67,9 +67,8 @@ func (suite *IndexTestSuite) TestIndexBeforeLowID() {
suite.NoError(err)
suite.Equal("01F8MHAAY43M6RJ473VQFCVH37", postID)
- // indexLength should only be 9 because that's all this user has hometimelineable
indexLength := suite.timeline.PostIndexLength()
- suite.Equal(9, indexLength)
+ suite.Equal(10, indexLength)
}
func (suite *IndexTestSuite) TestIndexBeforeHighID() {
@@ -97,9 +96,9 @@ func (suite *IndexTestSuite) TestIndexBehindHighID() {
suite.NoError(err)
suite.Equal("01FCTA44PW9H1TB328S9AQXKDS", postID)
- // indexLength should only be 11 because that's all this user has hometimelineable
+ // indexLength should be 10 because that's all this user has hometimelineable
indexLength := suite.timeline.PostIndexLength()
- suite.Equal(11, indexLength)
+ suite.Equal(10, indexLength)
}
func (suite *IndexTestSuite) TestIndexBehindLowID() {
diff --git a/internal/timeline/manager_test.go b/internal/timeline/manager_test.go
index 9b975a5ce..00c6dcb4a 100644
--- a/internal/timeline/manager_test.go
+++ b/internal/timeline/manager_test.go
@@ -66,9 +66,9 @@ func (suite *ManagerTestSuite) TestManagerIntegration() {
err = suite.manager.PrepareXFromTop(testAccount.ID, 20)
suite.NoError(err)
- // local_account_1 can see 11 statuses out of the testrig statuses in its home timeline
+ // local_account_1 can see 12 statuses out of the testrig statuses in its home timeline
indexedLen = suite.manager.GetIndexedLength(testAccount.ID)
- suite.Equal(11, indexedLen)
+ suite.Equal(12, indexedLen)
// oldest should now be set
oldestIndexed, err = suite.manager.GetOldestIndexedID(testAccount.ID)
@@ -78,7 +78,7 @@ func (suite *ManagerTestSuite) TestManagerIntegration() {
// get hometimeline
statuses, err := suite.manager.HomeTimeline(testAccount.ID, "", "", "", 20, false)
suite.NoError(err)
- suite.Len(statuses, 11)
+ suite.Len(statuses, 12)
// now wipe the last status from all timelines, as though it had been deleted by the owner
err = suite.manager.WipeStatusFromAllTimelines("01F8MH75CBF9JFX4ZAD54N0W0R")
@@ -86,7 +86,7 @@ func (suite *ManagerTestSuite) TestManagerIntegration() {
// timeline should be shorter
indexedLen = suite.manager.GetIndexedLength(testAccount.ID)
- suite.Equal(10, indexedLen)
+ suite.Equal(11, indexedLen)
// oldest should now be different
oldestIndexed, err = suite.manager.GetOldestIndexedID(testAccount.ID)
@@ -100,7 +100,7 @@ func (suite *ManagerTestSuite) TestManagerIntegration() {
// timeline should be shorter
indexedLen = suite.manager.GetIndexedLength(testAccount.ID)
- suite.Equal(9, indexedLen)
+ suite.Equal(10, indexedLen)
// oldest should now be different
oldestIndexed, err = suite.manager.GetOldestIndexedID(testAccount.ID)
diff --git a/internal/timeline/prepare.go b/internal/timeline/prepare.go
index 51846c816..20000b4e9 100644
--- a/internal/timeline/prepare.go
+++ b/internal/timeline/prepare.go
@@ -95,7 +95,7 @@ prepareloop:
if preparing {
if err := t.prepare(entry.statusID); err != nil {
// there's been an error
- if _, ok := err.(db.ErrNoEntries); !ok {
+ if err != db.ErrNoEntries {
// it's a real error
return fmt.Errorf("PrepareBehind: error preparing status with id %s: %s", entry.statusID, err)
}
@@ -150,7 +150,7 @@ prepareloop:
if preparing {
if err := t.prepare(entry.statusID); err != nil {
// there's been an error
- if _, ok := err.(db.ErrNoEntries); !ok {
+ if err != db.ErrNoEntries {
// it's a real error
return fmt.Errorf("PrepareBefore: error preparing status with id %s: %s", entry.statusID, err)
}
@@ -205,7 +205,7 @@ prepareloop:
if err := t.prepare(entry.statusID); err != nil {
// there's been an error
- if _, ok := err.(db.ErrNoEntries); !ok {
+ if err != db.ErrNoEntries {
// it's a real error
return fmt.Errorf("PrepareFromTop: error preparing status with id %s: %s", entry.statusID, err)
}