-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
Cache commit verification #33616
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
Cache commit verification #33616
Conversation
| src := t.AvatarLinkWithSize(au.ctx, size*setting.Avatar.RenderedSizeFactor) | ||
| if src != "" { | ||
| return AvatarHTML(src, size, class, t.DisplayName()) | ||
| if t != nil && t.ID != 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why it would happen?
| key := committer.Email | ||
| if c.Signature != nil { | ||
| key += fmt.Sprintf("-%s", c.Signature.Signature) | ||
| } | ||
| verification, ok := cachedVerifications[key] | ||
| if !ok { | ||
| verification = asymkey_service.ParseCommitWithSignatureCommitter(ctx, c.Commit, committer) | ||
| cachedVerifications[key] = verification | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How could it be right? Each commit's Signature is different from others?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the ParseCommitWithSignatureCommitter, the returned result will only be related to commit.Signature and email.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ParseCommitWithSignatureCommitter returns *asymkey_model.CommitVerification
type CommitVerification struct {
Verified bool
Warning bool
Reason string
SigningUser *user_model.User
CommittingUser *user_model.User
SigningEmail string
SigningKey *GPGKey
SigningSSHKey *PublicKey
TrustStatus string
}
Then this pointer is reused for different commits?
This comment was marked as off-topic.
This comment was marked as off-topic.
|
It seems it needs more refactor before sending this pull request. Closed at the moment. |
When loading the commit list, the verification will be checked. This PR cached the same verification on the same commits list to avoid duplicated computing.