Use non http API as fsAPI to avoid network requests (#2075)

Signed-off-by: Till Faelligen <tfaelligen@gmail.com>
This commit is contained in:
S7evinK 2021-12-20 11:27:58 +01:00 committed by GitHub
parent 640ba425e2
commit a47b12dc7d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -23,10 +23,10 @@ import (
func FederationAPI(base *basepkg.BaseDendrite, cfg *config.Dendrite) { func FederationAPI(base *basepkg.BaseDendrite, cfg *config.Dendrite) {
userAPI := base.UserAPIClient() userAPI := base.UserAPIClient()
federation := base.CreateFederationClient() federation := base.CreateFederationClient()
fsAPI := base.FederationAPIHTTPClient()
keyRing := fsAPI.KeyRing()
rsAPI := base.RoomserverHTTPClient() rsAPI := base.RoomserverHTTPClient()
keyAPI := base.KeyServerHTTPClient() keyAPI := base.KeyServerHTTPClient()
fsAPI := federationapi.NewInternalAPI(base, federation, rsAPI, base.Caches, nil, true)
keyRing := fsAPI.KeyRing()
federationapi.AddPublicRoutes( federationapi.AddPublicRoutes(
base.PublicFederationAPIMux, base.PublicKeyAPIMux, base.PublicWellKnownAPIMux, base.PublicFederationAPIMux, base.PublicKeyAPIMux, base.PublicWellKnownAPIMux,
@ -35,8 +35,7 @@ func FederationAPI(base *basepkg.BaseDendrite, cfg *config.Dendrite) {
&base.Cfg.MSCs, nil, &base.Cfg.MSCs, nil,
) )
intAPI := federationapi.NewInternalAPI(base, federation, rsAPI, base.Caches, nil, true) federationapi.AddInternalRoutes(base.InternalAPIMux, fsAPI)
federationapi.AddInternalRoutes(base.InternalAPIMux, intAPI)
base.SetupAndServeHTTP( base.SetupAndServeHTTP(
base.Cfg.FederationAPI.InternalAPI.Listen, base.Cfg.FederationAPI.InternalAPI.Listen,