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

@@ -29,6 +29,7 @@ import (
"github.com/superseriousbusiness/gotosocial/internal/text"
"github.com/superseriousbusiness/gotosocial/internal/typeutils"
"github.com/superseriousbusiness/gotosocial/internal/visibility"
"github.com/superseriousbusiness/gotosocial/internal/worker"
)
// Processor wraps a bunch of functions for processing statuses.
@@ -69,22 +70,22 @@ type Processor interface {
}
type processor struct {
tc typeutils.TypeConverter
db db.DB
filter visibility.Filter
formatter text.Formatter
fromClientAPI chan messages.FromClientAPI
parseMention gtsmodel.ParseMentionFunc
tc typeutils.TypeConverter
db db.DB
filter visibility.Filter
formatter text.Formatter
clientWorker *worker.Worker[messages.FromClientAPI]
parseMention gtsmodel.ParseMentionFunc
}
// New returns a new status processor.
func New(db db.DB, tc typeutils.TypeConverter, fromClientAPI chan messages.FromClientAPI, parseMention gtsmodel.ParseMentionFunc) Processor {
func New(db db.DB, tc typeutils.TypeConverter, clientWorker *worker.Worker[messages.FromClientAPI], parseMention gtsmodel.ParseMentionFunc) Processor {
return &processor{
tc: tc,
db: db,
filter: visibility.NewFilter(db),
formatter: text.NewFormatter(db),
fromClientAPI: fromClientAPI,
parseMention: parseMention,
tc: tc,
db: db,
filter: visibility.NewFilter(db),
formatter: text.NewFormatter(db),
clientWorker: clientWorker,
parseMention: parseMention,
}
}