Skip to content

Performance issue on pulls list API endpoint with lots of PR's #30483

Closed
@42wim

Description

@42wim

Description

We're running renovatebot and were getting timeouts (and renovatebot crashes) because the api/v1/repos/{owner}/{repo}/pulls?state=all endpoint is taking too long on repos with lots of PR's > 3k ( this takes almost 2 minutes, also the repo's are on NFS)

I've traced the issue to the ToAPIPullRequest function

func ToAPIPullRequest(ctx context.Context, pr *issues_model.PullRequest, doer *user_model.User) *api.PullRequest {

That function is doing git.OpenRepository a couple of times, which for > 3k pr's means it doing this ~ 10k times.
I'm not sure how to solve this, maybe it's possible to directly add extra keys to the PullRequest model so they don't need to be queried live or adding a separate cache for this ?

Gitea Version

1.21.10

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

No response

How are you running Gitea?

Using gitea docker image

Database

MySQL/MariaDB

Metadata

Metadata

Assignees

No one assigned

    Labels

    performance/speedperformance issues with slow downstopic/apiConcerns mainly the API

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions