mirror of
https://github.com/superseriousbusiness/gotosocial
synced 2025-06-05 21:59:39 +02:00
[feature/performance] Store account stats in separate table (#2831)
* [feature/performance] Store account stats in separate table, get stats from remote * test account stats * add some missing increment / decrement calls * change stats function signatures * rejig logging a bit * use lock when updating stats
This commit is contained in:
@ -55,10 +55,11 @@ func (suite *FromFediAPITestSuite) TestProcessFederationAnnounce() {
|
||||
announceStatus.Visibility = boostedStatus.Visibility
|
||||
|
||||
err := suite.processor.Workers().ProcessFromFediAPI(context.Background(), messages.FromFediAPI{
|
||||
APObjectType: ap.ActivityAnnounce,
|
||||
APActivityType: ap.ActivityCreate,
|
||||
GTSModel: announceStatus,
|
||||
ReceivingAccount: suite.testAccounts["local_account_1"],
|
||||
APObjectType: ap.ActivityAnnounce,
|
||||
APActivityType: ap.ActivityCreate,
|
||||
GTSModel: announceStatus,
|
||||
ReceivingAccount: suite.testAccounts["local_account_1"],
|
||||
RequestingAccount: boostingAccount,
|
||||
})
|
||||
suite.NoError(err)
|
||||
|
||||
@ -115,10 +116,11 @@ func (suite *FromFediAPITestSuite) TestProcessReplyMention() {
|
||||
|
||||
// Send the replied status off to the fedi worker to be further processed.
|
||||
err = suite.processor.Workers().ProcessFromFediAPI(context.Background(), messages.FromFediAPI{
|
||||
APObjectType: ap.ObjectNote,
|
||||
APActivityType: ap.ActivityCreate,
|
||||
APObjectModel: replyingStatusable,
|
||||
ReceivingAccount: suite.testAccounts["local_account_1"],
|
||||
APObjectType: ap.ObjectNote,
|
||||
APActivityType: ap.ActivityCreate,
|
||||
APObjectModel: replyingStatusable,
|
||||
ReceivingAccount: repliedAccount,
|
||||
RequestingAccount: replyingAccount,
|
||||
})
|
||||
suite.NoError(err)
|
||||
|
||||
@ -178,10 +180,11 @@ func (suite *FromFediAPITestSuite) TestProcessFave() {
|
||||
suite.NoError(err)
|
||||
|
||||
err = suite.processor.Workers().ProcessFromFediAPI(context.Background(), messages.FromFediAPI{
|
||||
APObjectType: ap.ActivityLike,
|
||||
APActivityType: ap.ActivityCreate,
|
||||
GTSModel: fave,
|
||||
ReceivingAccount: favedAccount,
|
||||
APObjectType: ap.ActivityLike,
|
||||
APActivityType: ap.ActivityCreate,
|
||||
GTSModel: fave,
|
||||
ReceivingAccount: favedAccount,
|
||||
RequestingAccount: favingAccount,
|
||||
})
|
||||
suite.NoError(err)
|
||||
|
||||
@ -247,10 +250,11 @@ func (suite *FromFediAPITestSuite) TestProcessFaveWithDifferentReceivingAccount(
|
||||
suite.NoError(err)
|
||||
|
||||
err = suite.processor.Workers().ProcessFromFediAPI(context.Background(), messages.FromFediAPI{
|
||||
APObjectType: ap.ActivityLike,
|
||||
APActivityType: ap.ActivityCreate,
|
||||
GTSModel: fave,
|
||||
ReceivingAccount: receivingAccount,
|
||||
APObjectType: ap.ActivityLike,
|
||||
APActivityType: ap.ActivityCreate,
|
||||
GTSModel: fave,
|
||||
ReceivingAccount: receivingAccount,
|
||||
RequestingAccount: favingAccount,
|
||||
})
|
||||
suite.NoError(err)
|
||||
|
||||
@ -318,10 +322,11 @@ func (suite *FromFediAPITestSuite) TestProcessAccountDelete() {
|
||||
|
||||
// now they are mufos!
|
||||
err = suite.processor.Workers().ProcessFromFediAPI(ctx, messages.FromFediAPI{
|
||||
APObjectType: ap.ObjectProfile,
|
||||
APActivityType: ap.ActivityDelete,
|
||||
GTSModel: deletedAccount,
|
||||
ReceivingAccount: receivingAccount,
|
||||
APObjectType: ap.ObjectProfile,
|
||||
APActivityType: ap.ActivityDelete,
|
||||
GTSModel: deletedAccount,
|
||||
ReceivingAccount: receivingAccount,
|
||||
RequestingAccount: deletedAccount,
|
||||
})
|
||||
suite.NoError(err)
|
||||
|
||||
@ -398,10 +403,11 @@ func (suite *FromFediAPITestSuite) TestProcessFollowRequestLocked() {
|
||||
suite.NoError(err)
|
||||
|
||||
err = suite.processor.Workers().ProcessFromFediAPI(ctx, messages.FromFediAPI{
|
||||
APObjectType: ap.ActivityFollow,
|
||||
APActivityType: ap.ActivityCreate,
|
||||
GTSModel: satanFollowRequestTurtle,
|
||||
ReceivingAccount: targetAccount,
|
||||
APObjectType: ap.ActivityFollow,
|
||||
APActivityType: ap.ActivityCreate,
|
||||
GTSModel: satanFollowRequestTurtle,
|
||||
ReceivingAccount: targetAccount,
|
||||
RequestingAccount: originAccount,
|
||||
})
|
||||
suite.NoError(err)
|
||||
|
||||
@ -451,10 +457,11 @@ func (suite *FromFediAPITestSuite) TestProcessFollowRequestUnlocked() {
|
||||
suite.NoError(err)
|
||||
|
||||
err = suite.processor.Workers().ProcessFromFediAPI(ctx, messages.FromFediAPI{
|
||||
APObjectType: ap.ActivityFollow,
|
||||
APActivityType: ap.ActivityCreate,
|
||||
GTSModel: satanFollowRequestTurtle,
|
||||
ReceivingAccount: targetAccount,
|
||||
APObjectType: ap.ActivityFollow,
|
||||
APActivityType: ap.ActivityCreate,
|
||||
GTSModel: satanFollowRequestTurtle,
|
||||
ReceivingAccount: targetAccount,
|
||||
RequestingAccount: originAccount,
|
||||
})
|
||||
suite.NoError(err)
|
||||
|
||||
@ -526,11 +533,12 @@ func (suite *FromFediAPITestSuite) TestCreateStatusFromIRI() {
|
||||
statusCreator := suite.testAccounts["remote_account_2"]
|
||||
|
||||
err := suite.processor.Workers().ProcessFromFediAPI(ctx, messages.FromFediAPI{
|
||||
APObjectType: ap.ObjectNote,
|
||||
APActivityType: ap.ActivityCreate,
|
||||
GTSModel: nil, // gtsmodel is nil because this is a forwarded status -- we want to dereference it using the iri
|
||||
ReceivingAccount: receivingAccount,
|
||||
APIri: testrig.URLMustParse("http://example.org/users/Some_User/statuses/afaba698-5740-4e32-a702-af61aa543bc1"),
|
||||
APObjectType: ap.ObjectNote,
|
||||
APActivityType: ap.ActivityCreate,
|
||||
GTSModel: nil, // gtsmodel is nil because this is a forwarded status -- we want to dereference it using the iri
|
||||
ReceivingAccount: receivingAccount,
|
||||
RequestingAccount: statusCreator,
|
||||
APIri: testrig.URLMustParse("http://example.org/users/Some_User/statuses/afaba698-5740-4e32-a702-af61aa543bc1"),
|
||||
})
|
||||
suite.NoError(err)
|
||||
|
||||
|
Reference in New Issue
Block a user