mirror of
https://github.com/1f349/dendrite.git
synced 2024-11-09 22:42:58 +00:00
Defer keyserver and federationsender wakeups to give HTTP listeners time to start (#1389)
This commit is contained in:
parent
33b8143a95
commit
04bc09f591
@ -20,6 +20,7 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
stateapi "github.com/matrix-org/dendrite/currentstateserver/api"
|
||||
"github.com/matrix-org/dendrite/federationsender/statistics"
|
||||
@ -65,6 +66,7 @@ func NewOutgoingQueues(
|
||||
queues: map[gomatrixserverlib.ServerName]*destinationQueue{},
|
||||
}
|
||||
// Look up which servers we have pending items for and then rehydrate those queues.
|
||||
time.AfterFunc(time.Second*5, func() {
|
||||
serverNames := map[gomatrixserverlib.ServerName]struct{}{}
|
||||
if names, err := db.GetPendingPDUServerNames(context.Background()); err == nil {
|
||||
for _, serverName := range names {
|
||||
@ -85,6 +87,7 @@ func NewOutgoingQueues(
|
||||
queues.getQueue(serverName).wakeQueueIfNeeded()
|
||||
}
|
||||
}
|
||||
})
|
||||
return queues
|
||||
}
|
||||
|
||||
|
@ -48,10 +48,11 @@ func NewInternalAPI(
|
||||
DB: db,
|
||||
}
|
||||
updater := internal.NewDeviceListUpdater(db, keyChangeProducer, fedClient, 8) // 8 workers TODO: configurable
|
||||
err = updater.Start()
|
||||
if err != nil {
|
||||
go func() {
|
||||
if err := updater.Start(); err != nil {
|
||||
logrus.WithError(err).Panicf("failed to start device list updater")
|
||||
}
|
||||
}()
|
||||
return &internal.KeyInternalAPI{
|
||||
DB: db,
|
||||
ThisServer: cfg.Matrix.ServerName,
|
||||
|
Loading…
Reference in New Issue
Block a user