Skip to content

Conversation

@lunny
Copy link
Member

@lunny lunny commented Feb 17, 2025

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.

@lunny lunny added the performance/speed performance issues with slow downs label Feb 17, 2025
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Feb 17, 2025
@github-actions github-actions bot added the modifies/go Pull requests that update Go code label Feb 17, 2025
src := t.AvatarLinkWithSize(au.ctx, size*setting.Avatar.RenderedSizeFactor)
if src != "" {
return AvatarHTML(src, size, class, t.DisplayName())
if t != nil && t.ID != 0 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why it would happen?

Comment on lines +46 to +54
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
}
Copy link
Contributor

@wxiaoguang wxiaoguang Feb 17, 2025

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?

Copy link
Member Author

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.

Copy link
Contributor

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?

@wxiaoguang

This comment was marked as off-topic.

@wxiaoguang wxiaoguang marked this pull request as draft February 19, 2025 07:01
@lunny
Copy link
Member Author

lunny commented Feb 22, 2025

It seems it needs more refactor before sending this pull request. Closed at the moment.

@lunny lunny closed this Feb 22, 2025
@lunny lunny deleted the lunny/cache_commit_verify branch February 22, 2025 03:25
@go-gitea go-gitea locked as resolved and limited conversation to collaborators May 23, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. modifies/go Pull requests that update Go code performance/speed performance issues with slow downs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants