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

Refactor request context #32956

Merged
merged 5 commits into from
Dec 24, 2024
Merged

Refactor request context #32956

merged 5 commits into from
Dec 24, 2024

Conversation

wxiaoguang
Copy link
Contributor

@wxiaoguang wxiaoguang commented Dec 22, 2024

Introduce RequestContext: is a short-lived context that is used to store request-specific data.

RequestContext could be used to clean form tmp files, close context git repo, and do some tracing in the future.

Then a lot of legacy code could be removed or improved. For example: most ctx.Repo.GitRepo.Close() could be removed because the git repo could be closed when the request is done.

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Dec 22, 2024
@pull-request-size pull-request-size bot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Dec 22, 2024
@github-actions github-actions bot added modifies/api This PR adds API routes or modifies them modifies/go Pull requests that update Go code labels Dec 22, 2024
@wxiaoguang wxiaoguang marked this pull request as draft December 22, 2024 18:41
@wxiaoguang wxiaoguang force-pushed the refactor-ctx branch 2 times, most recently from 86888fe to 87c5bb8 Compare December 22, 2024 19:52
@wxiaoguang wxiaoguang marked this pull request as ready for review December 22, 2024 19:53
@wxiaoguang wxiaoguang force-pushed the refactor-ctx branch 2 times, most recently from 879a8e7 to 633f0e7 Compare December 22, 2024 20:21
@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 Dec 22, 2024
@lunny lunny added the type/refactoring Existing code has been cleaned up. There should be no new functionality. label Dec 22, 2024
@lunny lunny added this to the 1.24.0 milestone Dec 22, 2024
@wxiaoguang wxiaoguang requested a review from Zettat123 December 23, 2024 03:07
routers/common/middleware.go Show resolved Hide resolved
@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 24, 2024
@lunny lunny added the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Dec 24, 2024
@wxiaoguang wxiaoguang merged commit 6d5aa92 into go-gitea:main Dec 24, 2024
26 checks passed
@GiteaBot GiteaBot removed the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Dec 24, 2024
@wxiaoguang wxiaoguang deleted the refactor-ctx branch December 24, 2024 03:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. modifies/api This PR adds API routes or modifies them modifies/go Pull requests that update Go code size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. type/refactoring Existing code has been cleaned up. There should be no new functionality.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants