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

Add more test directory to exclude dir of air, remove watching templates from air include dir because gitea has internal mechanism #22246

Merged
merged 3 commits into from
Dec 27, 2022

Conversation

lunny
Copy link
Member

@lunny lunny commented Dec 27, 2022

Since #20218 introduced internal watching template, template watching should be removed from air. This will prevent restart the whole server but only recompile templates once the template files changed to speed up developing when using make watch. Now a template change will only spend less than 1s in my macbook 2019 but over 20s before.

To ensure make watch will reuse template watching, this PR introduced a new ENV GITEA_RUN_MODE to make sure make watch will always run in a dev mode of Gitea so that template watching will open.

This PR also added more exclude testdata directories.

…tes from air include dir because gitea has internal mechanism
@lunny lunny added the topic/build PR changes how Gitea is built, i.e. regarding Docker or the Makefile label Dec 27, 2022
@lunny lunny added the outdated/backport/v1.18 This PR should be backported to Gitea 1.18 label Dec 27, 2022
@lunny lunny added this to the 1.19.0 milestone Dec 27, 2022
@GiteaBot GiteaBot added the lgtm/need 1 This PR needs approval from one additional maintainer to be merged. label Dec 27, 2022
@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 Dec 27, 2022
@lunny lunny merged commit 90237d8 into go-gitea:main Dec 27, 2022
@lunny lunny deleted the lunny/hot_reload_improve branch December 27, 2022 06:00
lunny added a commit to lunny/gitea that referenced this pull request Dec 27, 2022
…tes from air include dir because gitea has internal mechanism (go-gitea#22246)

Since go-gitea#20218 introduced internal watching template, template watching
should be removed from `air`. This will prevent restart the whole server
once the template files changed to speed up developing when using `make
watch`.

To ensure `make watch` will reuse template watching, this PR introduced
a new ENV `GITEA_RUN_MODE` to make sure `make watch` will always run in
a dev mode of Gitea so that template watching will open.

This PR also added more exclude testdata directories.
zjjhot added a commit to zjjhot/gitea that referenced this pull request Dec 27, 2022
* upstream/main:
  Add more test directory to exclude dir of air, remove watching templates from air include dir because gitea has internal mechanism (go-gitea#22246)
@lunny lunny added the backport/done All backports for this PR have been created label Dec 27, 2022
@silverwind
Copy link
Member

silverwind commented Dec 27, 2022

Will template changes still reload the dev server after this? It'd certainly be useful to not have to manually restart on template change.

@KN4CK3R
Copy link
Member

KN4CK3R commented Dec 27, 2022

Same question from my side. Editing a template file was also a very fast way to force a restart.

@lunny
Copy link
Member Author

lunny commented Dec 28, 2022

Will template changes still reload the dev server after this? It'd certainly be useful to not have to manually restart on template change.

Template changes will not reload the dev server any more but will fire internal template watching, that means only templates will be recompiled again once template changed and no any manually operation needed. This is obviously faster than before, because there is no server restart, no database init, no web listen and etc.

@lunny
Copy link
Member Author

lunny commented Dec 28, 2022

Same question from my side. Editing a template file was also a very fast way to force a restart.

You could change a go file to implement it now.

@KN4CK3R
Copy link
Member

KN4CK3R commented Dec 28, 2022

Same question from my side. Editing a template file was also a very fast way to force a restart.

You could change a go file to implement it now.

Sure but now I need to search for a file which does not force recompilation of a big part of our codebase to make it fast. But that was just convenience.

@lunny
Copy link
Member Author

lunny commented Dec 28, 2022

Same question from my side. Editing a template file was also a very fast way to force a restart.

You could change a go file to implement it now.

Sure but now I need to search for a file which does not force recompilation of a big part of our codebase to make it fast. But that was just convenience.

You can always edit main.go because no other code depend it.

@silverwind
Copy link
Member

If template changes automatically reload it in the server without a restart, that's fine with me. So on next F5, it should serve the new template. I will try it.

KN4CK3R pushed a commit that referenced this pull request Dec 29, 2022
…tes from air include dir because gitea has internal mechanism (#22246) (#22247)

backport #22246 

Since #20218 introduced internal watching template, template watching
should be removed from `air`. This will prevent restart the whole server
once the template files changed to speed up developing when using `make
watch`.

To ensure `make watch` will reuse template watching, this PR introduced
a new ENV `GITEA_RUN_MODE` to make sure `make watch` will always run in
a dev mode of Gitea so that template watching will open.

This PR also added more exclude testdata directories.

Co-authored-by: 6543 <6543@obermui.de>
@go-gitea go-gitea locked and limited conversation to collaborators May 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
backport/done All backports for this PR have been created lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. outdated/backport/v1.18 This PR should be backported to Gitea 1.18 topic/build PR changes how Gitea is built, i.e. regarding Docker or the Makefile
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants