Reuse the existing lazyload cache on /context and /messages (#2367)

This commit is contained in:
Till 2022-04-22 11:38:29 +02:00 committed by GitHub
parent 0eb5bd1e13
commit c07f347f00
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 31 additions and 8 deletions

View file

@ -18,6 +18,7 @@ import (
"net/http"
"github.com/gorilla/mux"
"github.com/matrix-org/dendrite/internal/caching"
"github.com/matrix-org/dendrite/internal/httputil"
"github.com/matrix-org/dendrite/roomserver/api"
"github.com/matrix-org/dendrite/setup/config"
@ -38,6 +39,7 @@ func Setup(
userAPI userapi.UserInternalAPI, federation *gomatrixserverlib.FederationClient,
rsAPI api.RoomserverInternalAPI,
cfg *config.SyncAPI,
lazyLoadCache *caching.LazyLoadCache,
) {
v3mux := csMux.PathPrefix("/{apiversion:(?:r0|v3)}/").Subrouter()
@ -51,7 +53,7 @@ func Setup(
if err != nil {
return util.ErrorResponse(err)
}
return OnIncomingMessagesRequest(req, syncDB, vars["roomID"], device, federation, rsAPI, cfg, srp)
return OnIncomingMessagesRequest(req, syncDB, vars["roomID"], device, federation, rsAPI, cfg, srp, lazyLoadCache)
})).Methods(http.MethodGet, http.MethodOptions)
v3mux.Handle("/user/{userId}/filter",
@ -89,6 +91,7 @@ func Setup(
req, device,
rsAPI, syncDB,
vars["roomId"], vars["eventId"],
lazyLoadCache,
)
}),
).Methods(http.MethodGet, http.MethodOptions)