Make usage of relays optional, avoid DB roundtrips (#3337)

This should avoid 2 additional DB roundtrips if we don't want to use
relays.

So instead of possibly doing roughly 20k trips to the DB, we are now
"only" doing ~6600.

---------

Co-authored-by: devonh <devon.dmytro@gmail.com>
This commit is contained in:
Till 2024-02-28 20:59:34 +01:00 committed by GitHub
parent 4ccf6d6f67
commit 865fff5f03
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 32 additions and 17 deletions

View file

@ -113,10 +113,7 @@ func NewInternalAPI(
_ = federationDB.RemoveAllServersFromBlacklist()
}
stats := statistics.NewStatistics(
federationDB,
cfg.FederationMaxRetries+1,
cfg.P2PFederationRetriesUntilAssumedOffline+1)
stats := statistics.NewStatistics(federationDB, cfg.FederationMaxRetries+1, cfg.P2PFederationRetriesUntilAssumedOffline+1, cfg.EnableRelays)
js, nats := natsInstance.Prepare(processContext, &cfg.Matrix.JetStream)