mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-18 10:57:35 -06:00
[performance] Tweak media attachment cleanup; replace stale index (#2143)
This commit is contained in:
parent
b6c07a71d3
commit
c7a46e05db
5 changed files with 104 additions and 153 deletions
|
|
@ -23,7 +23,6 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/stretchr/testify/suite"
|
||||
"github.com/superseriousbusiness/gotosocial/testrig"
|
||||
)
|
||||
|
||||
type MediaTestSuite struct {
|
||||
|
|
@ -43,20 +42,12 @@ func (suite *MediaTestSuite) TestGetOlder() {
|
|||
suite.Len(attachments, 2)
|
||||
}
|
||||
|
||||
func (suite *MediaTestSuite) TestGetAvisAndHeaders() {
|
||||
func (suite *MediaTestSuite) TestGetCachedAttachmentsOlderThan() {
|
||||
ctx := context.Background()
|
||||
|
||||
attachments, err := suite.db.GetAvatarsAndHeaders(ctx, "", 20)
|
||||
attachments, err := suite.db.GetCachedAttachmentsOlderThan(ctx, time.Now(), 20)
|
||||
suite.NoError(err)
|
||||
suite.Len(attachments, 3)
|
||||
}
|
||||
|
||||
func (suite *MediaTestSuite) TestGetLocalUnattachedOlderThan() {
|
||||
ctx := context.Background()
|
||||
|
||||
attachments, err := suite.db.GetLocalUnattachedOlderThan(ctx, testrig.TimeMustParse("2090-06-04T13:12:00Z"), 10)
|
||||
suite.NoError(err)
|
||||
suite.Len(attachments, 1)
|
||||
suite.Len(attachments, 2)
|
||||
}
|
||||
|
||||
func TestMediaTestSuite(t *testing.T) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue