replace async client API / federator msg processing with worker pools (#497)

* replace async client API / federator msg processing with worker pools
* appease our lord-and-saviour, the linter
This commit is contained in:
kim
2022-04-28 13:23:11 +01:00
committed by GitHub
parent cc5f2e98b7
commit 420e2fb22b
64 changed files with 573 additions and 336 deletions

View File

@ -30,18 +30,19 @@ import (
"github.com/superseriousbusiness/gotosocial/internal/processing/status"
"github.com/superseriousbusiness/gotosocial/internal/transport"
"github.com/superseriousbusiness/gotosocial/internal/typeutils"
"github.com/superseriousbusiness/gotosocial/internal/worker"
"github.com/superseriousbusiness/gotosocial/testrig"
)
type StatusStandardTestSuite struct {
suite.Suite
db db.DB
typeConverter typeutils.TypeConverter
tc transport.Controller
storage *kv.KVStore
mediaManager media.Manager
federator federation.Federator
fromClientAPIChan chan messages.FromClientAPI
db db.DB
typeConverter typeutils.TypeConverter
tc transport.Controller
storage *kv.KVStore
mediaManager media.Manager
federator federation.Federator
clientWorker *worker.Worker[messages.FromClientAPI]
// standard suite models
testTokens map[string]*gtsmodel.Token
@ -74,14 +75,16 @@ func (suite *StatusStandardTestSuite) SetupTest() {
testrig.InitTestConfig()
testrig.InitTestLog()
fedWorker := worker.New[messages.FromFederator](-1, -1)
suite.db = testrig.NewTestDB()
suite.typeConverter = testrig.NewTestTypeConverter(suite.db)
suite.fromClientAPIChan = make(chan messages.FromClientAPI, 100)
suite.tc = testrig.NewTestTransportController(testrig.NewMockHTTPClient(nil), suite.db)
suite.clientWorker = worker.New[messages.FromClientAPI](-1, -1)
suite.tc = testrig.NewTestTransportController(testrig.NewMockHTTPClient(nil), suite.db, fedWorker)
suite.storage = testrig.NewTestStorage()
suite.mediaManager = testrig.NewTestMediaManager(suite.db, suite.storage)
suite.federator = testrig.NewTestFederator(suite.db, suite.tc, suite.storage, suite.mediaManager)
suite.status = status.New(suite.db, suite.typeConverter, suite.fromClientAPIChan, processing.GetParseMentionFunc(suite.db, suite.federator))
suite.federator = testrig.NewTestFederator(suite.db, suite.tc, suite.storage, suite.mediaManager, fedWorker)
suite.status = status.New(suite.db, suite.typeConverter, suite.clientWorker, processing.GetParseMentionFunc(suite.db, suite.federator))
testrig.StandardDBSetup(suite.db, suite.testAccounts)
testrig.StandardStorageSetup(suite.storage, "../../../testrig/media")