mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-06 22:43:10 -06:00
Make the worker count configurable
This commit is contained in:
parent
210f108306
commit
e7996edf65
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Reference in a new issue