Make the worker count configurable

This commit is contained in:
Till Faelligen 2023-10-31 13:40:46 +01:00
parent 210f108306
commit e7996edf65
No known key found for this signature in database
GPG key ID: ACCDC9606D472758
3 changed files with 10 additions and 1 deletions

View file

@ -325,6 +325,10 @@ user_api:
auto_join_rooms:
# - "#main:matrix.org"
# The number of device list updater workers to start. Defaults to 8.
# This only needs updating if the "InputDeviceListUpdate" stream keeps growing indefinitely.
# worker_count: 8
# Configuration for Opentracing.
# See https://github.com/matrix-org/dendrite/tree/master/docs/tracing for information on
# how this works and how to set it up.

View file

@ -21,6 +21,10 @@ type UserAPI struct {
// Users who register on this homeserver will automatically
// be joined to the rooms listed under this option.
AutoJoinRooms []string `yaml:"auto_join_rooms"`
// The number of workers to start for the DeviceListUpdater.
// Setting this too low may result in the "InputDeviceListUpdate" growing forever.
WorkerCount int `yaml:"worker_count"`
}
const DefaultOpenIDTokenLifetimeMS = 3600000 // 60 minutes
@ -28,6 +32,7 @@ const DefaultOpenIDTokenLifetimeMS = 3600000 // 60 minutes
func (c *UserAPI) Defaults(opts DefaultOpts) {
c.BCryptCost = bcrypt.DefaultCost
c.OpenIDTokenLifetimeMS = DefaultOpenIDTokenLifetimeMS
c.WorkerCount = 8
if opts.Generate {
if !opts.SingleDatabase {
c.AccountDatabase.ConnectionString = "file:userapi_accounts.db"

View file

@ -100,7 +100,7 @@ func NewInternalAPI(
FedClient: fedClient,
}
updater := internal.NewDeviceListUpdater(processContext, keyDB, userAPI, keyChangeProducer, fedClient, 8, rsAPI, dendriteCfg.Global.ServerName, enableMetrics) // 8 workers TODO: configurable
updater := internal.NewDeviceListUpdater(processContext, keyDB, userAPI, keyChangeProducer, fedClient, dendriteCfg.UserAPI.WorkerCount, rsAPI, dendriteCfg.Global.ServerName, enableMetrics)
userAPI.Updater = updater
// Remove users which we don't share a room with anymore
if err := updater.CleanUp(); err != nil {