mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-30 13:43:31 -06:00
[chore] update database caching library (#1040)
* convert most of the caches to use result.Cache{}
* add caching of emojis
* fix issues causing failing tests
* update go-cache/v2 instances with v3
* fix getnotification
* add a note about the left-in StatusCreate comment
* update EmojiCategory db access to use new result.Cache{}
* fix possible panic in getstatusparents
* further proof that kim is not stinky
This commit is contained in:
parent
9ab60136dd
commit
8598dea98b
55 changed files with 725 additions and 2289 deletions
|
|
@ -35,44 +35,52 @@ type TimelineTestSuite struct {
|
|||
}
|
||||
|
||||
func (suite *TimelineTestSuite) TestGetPublicTimeline() {
|
||||
s, err := suite.db.GetPublicTimeline(context.Background(), "", "", "", 20, false)
|
||||
ctx := context.Background()
|
||||
|
||||
s, err := suite.db.GetPublicTimeline(ctx, "", "", "", 20, false)
|
||||
suite.NoError(err)
|
||||
|
||||
suite.Len(s, 6)
|
||||
}
|
||||
|
||||
func (suite *TimelineTestSuite) TestGetPublicTimelineWithFutureStatus() {
|
||||
futureStatus := getFutureStatus()
|
||||
if err := suite.db.Put(context.Background(), futureStatus); err != nil {
|
||||
suite.FailNow(err.Error())
|
||||
}
|
||||
ctx := context.Background()
|
||||
|
||||
s, err := suite.db.GetPublicTimeline(context.Background(), "", "", "", 20, false)
|
||||
futureStatus := getFutureStatus()
|
||||
err := suite.db.PutStatus(ctx, futureStatus)
|
||||
suite.NoError(err)
|
||||
|
||||
s, err := suite.db.GetPublicTimeline(ctx, "", "", "", 20, false)
|
||||
suite.NoError(err)
|
||||
|
||||
suite.NotContains(s, futureStatus)
|
||||
suite.Len(s, 6)
|
||||
}
|
||||
|
||||
func (suite *TimelineTestSuite) TestGetHomeTimeline() {
|
||||
ctx := context.Background()
|
||||
|
||||
viewingAccount := suite.testAccounts["local_account_1"]
|
||||
|
||||
s, err := suite.db.GetHomeTimeline(context.Background(), viewingAccount.ID, "", "", "", 20, false)
|
||||
s, err := suite.db.GetHomeTimeline(ctx, viewingAccount.ID, "", "", "", 20, false)
|
||||
suite.NoError(err)
|
||||
|
||||
suite.Len(s, 16)
|
||||
}
|
||||
|
||||
func (suite *TimelineTestSuite) TestGetHomeTimelineWithFutureStatus() {
|
||||
ctx := context.Background()
|
||||
|
||||
viewingAccount := suite.testAccounts["local_account_1"]
|
||||
|
||||
futureStatus := getFutureStatus()
|
||||
if err := suite.db.Put(context.Background(), futureStatus); err != nil {
|
||||
suite.FailNow(err.Error())
|
||||
}
|
||||
err := suite.db.PutStatus(ctx, futureStatus)
|
||||
suite.NoError(err)
|
||||
|
||||
s, err := suite.db.GetHomeTimeline(context.Background(), viewingAccount.ID, "", "", "", 20, false)
|
||||
suite.NoError(err)
|
||||
|
||||
suite.NotContains(s, futureStatus)
|
||||
suite.Len(s, 16)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue