1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-08-26 18:21:01 +00:00

refactor(templates): be explicit about dependencies

Instead of blindly compiling all the common/ templates for every view/ ones,
let's be explicit about the dependencies. This should significantly decrease
the resident memory consumption, as ParseTemplate is responsible for ~10M of
the current 11M of heap memory on my instance, so any win there is interesting.
This will also allow better factorization of templates, now that everything is
explicit. Another side-effect is that it'll make testing easier, as we now have
a comprehensive list of views/ templates affected by a change in a file in
common/
This commit is contained in:
jvoisin 2025-08-08 18:00:59 +02:00 committed by Frédéric Guillot
parent b30eac4ebe
commit da8bf3890c
3 changed files with 50 additions and 34 deletions

View file

@ -19,9 +19,7 @@ func Serve(router *mux.Router, store *storage.Storage, pool *worker.Pool) {
middleware := newMiddleware(router, store)
templateEngine := template.NewEngine(router)
if err := templateEngine.ParseTemplates(); err != nil {
panic(err)
}
templateEngine.ParseTemplates()
handler := &handler{router, store, templateEngine, pool}