Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use globally shared HTMLRender #24436

Merged
merged 4 commits into from Apr 30, 2023
Merged

Use globally shared HTMLRender #24436

merged 4 commits into from Apr 30, 2023

Conversation

wxiaoguang
Copy link
Contributor

The old HTMLRender is not ideal.

  1. It shouldn't be initialized multiple times, it consumes a lot of memory and is slow.
  2. It shouldn't depend on short-lived requests, the WatchLocalChanges needs a long-running context.
  3. It doesn't make sense to use FuncsMap slice.

HTMLRender was designed to only work for GItea's specialized 400+ templates, so it's good to make it a global shared instance.

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Apr 30, 2023
@pull-request-size pull-request-size bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Apr 30, 2023
wxiaoguang and others added 2 commits April 30, 2023 11:59
Co-authored-by: 6543 <6543@obermui.de>
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Apr 30, 2023
@delvh delvh added performance/memory Performance issues affecting memory use lgtm/need 1 This PR needs approval from one additional maintainer to be merged. performance/cpu and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Apr 30, 2023
@delvh delvh added this to the 1.20.0 milestone Apr 30, 2023
@wxiaoguang
Copy link
Contributor Author

wxiaoguang commented Apr 30, 2023

IMO in most cases it doesn't affect performance, so no need to mark it as performance or CPU. Only some rare cases that the ctx doesn't contain the pre-created render would cause multiple instances.

This PR is mainly a preparation for the context function

@wxiaoguang wxiaoguang removed performance/memory Performance issues affecting memory use performance/cpu labels Apr 30, 2023
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Apr 30, 2023
@6543 6543 added the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Apr 30, 2023
@6543 6543 enabled auto-merge (squash) April 30, 2023 11:57
@6543 6543 merged commit e375037 into go-gitea:main Apr 30, 2023
2 checks passed
@GiteaBot GiteaBot removed the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Apr 30, 2023
@wxiaoguang wxiaoguang deleted the fix-html-render branch April 30, 2023 12:31
@go-gitea go-gitea locked as resolved and limited conversation to collaborators Jul 31, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants