-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Improve cache context #23330
Merged
jolheiser
merged 12 commits into
go-gitea:main
from
wolfogre:feature/improve_context_cache
Mar 8, 2023
Merged
Improve cache context #23330
jolheiser
merged 12 commits into
go-gitea:main
from
wolfogre:feature/improve_context_cache
Mar 8, 2023
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lunny
reviewed
Mar 6, 2023
GiteaBot
added
the
lgtm/need 2
This PR needs two approvals by maintainers to be considered for merging.
label
Mar 6, 2023
The description seems very valuable. Maybe the description could be put into code as package comment? If would help future developers when they are using the package. |
delvh
reviewed
Mar 6, 2023
delvh
approved these changes
Mar 6, 2023
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
Mar 6, 2023
lunny
reviewed
Mar 7, 2023
lunny
reviewed
Mar 7, 2023
lunny
approved these changes
Mar 7, 2023
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
Mar 7, 2023
wolfogre
added
the
reviewed/wait-merge
This pull request is part of the merge queue. It will be merged soon.
label
Mar 8, 2023
🎺 🤖 |
jolheiser
removed
the
reviewed/wait-merge
This pull request is part of the merge queue. It will be merged soon.
label
Mar 8, 2023
zjjhot
added a commit
to zjjhot/gitea
that referenced
this pull request
Mar 9, 2023
* giteaofficial/main: Test renderReadmeFile (go-gitea#23185) [skip ci] Updated translations via Crowdin Set `X-Gitea-Debug` header once (go-gitea#23361) Improve cache context (go-gitea#23330) add user visibility in dashboard navbar (go-gitea#22747) Fix panic when getting notes by ref (go-gitea#23372) Use CleanPath instead of path.Clean (go-gitea#23371) Reduce duplicate and useless code in options (go-gitea#23369) Clean Path in Options (go-gitea#23006) Do not recognize text files as audio (go-gitea#23355) Fix incorrect display for comment context menu (go-gitea#23343) # Conflicts: # templates/repo/issue/view_content/context_menu.tmpl
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.
type/enhancement
An improvement of existing functionality
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Related to: #22294 #23186 #23054
Replace: #23218
Some discussion is in the comments of #23218.
Highlights:
discard
field tocacheContext
, acacheContext
withdiscard
true will drop all cached data and won't store any new one.WithNoCacheContext
, if one wants to run long-life tasks, but the parent context is a cache context,WithNoCacheContext(perentCtx)
will discard the cache data, so it will be safe to keep the context for a long time.GetContextData(context.Backgraud())
, no warning logs will be printed.Some cases about nesting:
When:
A,BorCmeans a discard cache context.ctx
meanscontext.Backgrand()
ctx
as the parent context.A(ctx)
as the parent context.With
meansWithCacheContext
WithNo
meansWithNoCacheContext
So:
With(ctx)
-> A(ctx)With(With(ctx))
-> A(ctx), not B(A(ctx))With(With(With(ctx)))
-> A(ctx), not C(B(A(ctx)))WithNo(ctx)
-> ctx, notA(ctx)WithNo(With(ctx))
->A(ctx)WithNo(WithNo(With(ctx)))
->A(ctx), notB(A(ctx))With(WithNo(With(ctx)))
-> B(A(ctx))WithNo(With(WithNo(With(ctx))))
->B(A(ctx))With(WithNo(With(WithNo(With(ctx)))))
-> C(B(A(ctx)))