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:
parent
b30eac4ebe
commit
da8bf3890c
3 changed files with 50 additions and 34 deletions
|
@ -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}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue