From 3cceed11b28b5f42a653d85ed779d652fd8c26ad Mon Sep 17 00:00:00 2001 From: tobi <31960611+tsmethurst@users.noreply.github.com> Date: Tue, 16 Apr 2024 13:10:13 +0200 Subject: [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 --- internal/processing/workers/fromclientapi_test.go | 66 ++++++++++++----------- 1 file changed, 36 insertions(+), 30 deletions(-) (limited to 'internal/processing/workers/fromclientapi_test.go') diff --git a/internal/processing/workers/fromclientapi_test.go b/internal/processing/workers/fromclientapi_test.go index 3d3630b11..5e294597d 100644 --- a/internal/processing/workers/fromclientapi_test.go +++ b/internal/processing/workers/fromclientapi_test.go @@ -182,11 +182,6 @@ func (suite *FromClientAPITestSuite) TestProcessCreateStatusWithNotification() { nil, nil, ) - statusJSON = suite.statusJSON( - ctx, - status, - receivingAccount, - ) ) // Update the follow from receiving account -> posting account so @@ -212,6 +207,12 @@ func (suite *FromClientAPITestSuite) TestProcessCreateStatusWithNotification() { suite.FailNow(err.Error()) } + statusJSON := suite.statusJSON( + ctx, + status, + receivingAccount, + ) + // Check message in home stream. suite.checkStreamed( homeStream, @@ -285,11 +286,6 @@ func (suite *FromClientAPITestSuite) TestProcessCreateStatusReply() { suite.testStatuses["local_account_2_status_1"], nil, ) - statusJSON = suite.statusJSON( - ctx, - status, - receivingAccount, - ) ) // Process the new status. @@ -305,6 +301,12 @@ func (suite *FromClientAPITestSuite) TestProcessCreateStatusReply() { suite.FailNow(err.Error()) } + statusJSON := suite.statusJSON( + ctx, + status, + receivingAccount, + ) + // Check message in home stream. suite.checkStreamed( homeStream, @@ -451,11 +453,6 @@ func (suite *FromClientAPITestSuite) TestProcessCreateStatusListRepliesPolicyLis suite.testStatuses["local_account_2_status_1"], nil, ) - statusJSON = suite.statusJSON( - ctx, - status, - receivingAccount, - ) ) // Modify replies policy of test list to show replies @@ -480,6 +477,12 @@ func (suite *FromClientAPITestSuite) TestProcessCreateStatusListRepliesPolicyLis suite.FailNow(err.Error()) } + statusJSON := suite.statusJSON( + ctx, + status, + receivingAccount, + ) + // Check message in home stream. suite.checkStreamed( homeStream, @@ -518,11 +521,6 @@ func (suite *FromClientAPITestSuite) TestProcessCreateStatusListRepliesPolicyLis suite.testStatuses["local_account_2_status_1"], nil, ) - statusJSON = suite.statusJSON( - ctx, - status, - receivingAccount, - ) ) // Modify replies policy of test list to show replies @@ -552,6 +550,12 @@ func (suite *FromClientAPITestSuite) TestProcessCreateStatusListRepliesPolicyLis suite.FailNow(err.Error()) } + statusJSON := suite.statusJSON( + ctx, + status, + receivingAccount, + ) + // Check message in home stream. suite.checkStreamed( homeStream, @@ -590,11 +594,6 @@ func (suite *FromClientAPITestSuite) TestProcessCreateStatusReplyListRepliesPoli suite.testStatuses["local_account_2_status_1"], nil, ) - statusJSON = suite.statusJSON( - ctx, - status, - receivingAccount, - ) ) // Modify replies policy of test list. @@ -619,6 +618,12 @@ func (suite *FromClientAPITestSuite) TestProcessCreateStatusReplyListRepliesPoli suite.FailNow(err.Error()) } + statusJSON := suite.statusJSON( + ctx, + status, + receivingAccount, + ) + // Check message in home stream. suite.checkStreamed( homeStream, @@ -654,11 +659,6 @@ func (suite *FromClientAPITestSuite) TestProcessCreateStatusBoost() { nil, suite.testStatuses["local_account_2_status_1"], ) - statusJSON = suite.statusJSON( - ctx, - status, - receivingAccount, - ) ) // Process the new status. @@ -674,6 +674,12 @@ func (suite *FromClientAPITestSuite) TestProcessCreateStatusBoost() { suite.FailNow(err.Error()) } + statusJSON := suite.statusJSON( + ctx, + status, + receivingAccount, + ) + // Check message in home stream. suite.checkStreamed( homeStream, -- cgit v1.2.3