gitea/services
zeripath bb0ff77e46
Share HTML template renderers and create a watcher framework (#20218)
The recovery, API, Web and package frameworks all create their own HTML
Renderers. This increases the memory requirements of Gitea
unnecessarily with duplicate templates being kept in memory.

Further the reloading framework in dev mode for these involves locking
and recompiling all of the templates on each load. This will potentially
hide concurrency issues and it is inefficient.

This PR stores the templates renderer in the context and stores this
context in the NormalRoutes, it then creates a fsnotify.Watcher
framework to watch files.

The watching framework is then extended to the mailer templates which
were previously not being reloaded in dev.

Then the locales are simplified to a similar structure.

Fix #20210 
Fix #20211
Fix #20217

Signed-off-by: Andrew Thornton <art27@cantab.net>
2022-08-28 10:43:25 +01:00
..
agit Add more linters to improve code readability (#19989) 2022-06-20 12:02:49 +02:00
asymkey Refactor AssertExistsAndLoadBean to use generics (#20797) 2022-08-16 10:22:25 +08:00
attachment Refactor AssertExistsAndLoadBean to use generics (#20797) 2022-08-16 10:22:25 +08:00
auth Share HTML template renderers and create a watcher framework (#20218) 2022-08-28 10:43:25 +01:00
automerge Add more linters to improve code readability (#19989) 2022-06-20 12:02:49 +02:00
comments Move issues related files into models/issues (#19931) 2022-06-13 17:37:59 +08:00
context Move almost all functions' parameter db.Engine to context.Context (#19748) 2022-05-20 22:08:52 +08:00
cron Move some files into models' sub packages (#20262) 2022-08-25 10:31:57 +08:00
externalaccount Refactor auth package (#17962) 2022-01-02 21:12:35 +08:00
forms refactor webhook *NewPost (#20729) 2022-08-11 17:48:23 +02:00
gitdiff Refactor AssertExistsAndLoadBean to use generics (#20797) 2022-08-16 10:22:25 +08:00
issue Move some files into models' sub packages (#20262) 2022-08-25 10:31:57 +08:00
lfs Move some code into models/git (#19879) 2022-06-12 23:51:54 +08:00
mailer Share HTML template renderers and create a watcher framework (#20218) 2022-08-28 10:43:25 +01:00
migrations Move some files into models' sub packages (#20262) 2022-08-25 10:31:57 +08:00
mirror Add new API endpoints for push mirrors management (#19841) 2022-07-30 18:45:59 +02:00
org Move some files into models' sub packages (#20262) 2022-08-25 10:31:57 +08:00
packages Replace ServeStream with ServeContent (#20903) 2022-08-25 12:05:21 -04:00
pull Prevent 500 is head repo does not have PullRequest unit in IsUserAllowedToUpdate (#20839) 2022-08-18 13:31:15 +03:00
release Move some files into models' sub packages (#20262) 2022-08-25 10:31:57 +08:00
repository Move some files into models' sub packages (#20262) 2022-08-25 10:31:57 +08:00
task Move some files into models' sub packages (#20262) 2022-08-25 10:31:57 +08:00
user Refactor AssertExistsAndLoadBean to use generics (#20797) 2022-08-16 10:22:25 +08:00
webhook Refactor AssertExistsAndLoadBean to use generics (#20797) 2022-08-16 10:22:25 +08:00
wiki Move some files into models' sub packages (#20262) 2022-08-25 10:31:57 +08:00