Skip to content
Snippets Groups Projects
Unverified Commit 3c60625c authored by chris48s's avatar chris48s Committed by GitHub
Browse files

improve performance of [GithubLastCommit] [GitlabLastCommit] [GiteaLastCommit] (#10046)

* improve performance of last commit badges

* pass param in the right place
parent 5405dad3
Branches
Tags
No related merge requests found
...@@ -126,7 +126,7 @@ export default class GiteaLastCommit extends GiteaBase { ...@@ -126,7 +126,7 @@ export default class GiteaLastCommit extends GiteaBase {
return super.fetch({ return super.fetch({
schema, schema,
url: `${baseUrl}/api/v1/repos/${user}/${repo}/commits`, url: `${baseUrl}/api/v1/repos/${user}/${repo}/commits`,
options: { searchParams: { sha: branch, path } }, options: { searchParams: { sha: branch, path, limit: 1 } },
httpErrors: httpErrorsFor(), httpErrors: httpErrorsFor(),
}) })
} }
......
...@@ -98,7 +98,7 @@ export default class GithubLastCommit extends GithubAuthV3Service { ...@@ -98,7 +98,7 @@ export default class GithubLastCommit extends GithubAuthV3Service {
async fetch({ user, repo, branch, path }) { async fetch({ user, repo, branch, path }) {
return this._requestJson({ return this._requestJson({
url: `/repos/${user}/${repo}/commits`, url: `/repos/${user}/${repo}/commits`,
options: { searchParams: { sha: branch, path } }, options: { searchParams: { sha: branch, path, per_page: 1 } },
schema, schema,
httpErrors: httpErrorsFor(), httpErrors: httpErrorsFor(),
}) })
......
...@@ -79,7 +79,7 @@ export default class GitlabLastCommit extends GitLabBase { ...@@ -79,7 +79,7 @@ export default class GitlabLastCommit extends GitLabBase {
url: `${baseUrl}/api/v4/projects/${encodeURIComponent( url: `${baseUrl}/api/v4/projects/${encodeURIComponent(
project, project,
)}/repository/commits`, )}/repository/commits`,
options: { searchParams: { ref_name: ref, path } }, options: { searchParams: { ref_name: ref, path, per_page: 1 } },
schema, schema,
httpErrors: httpErrorsFor('project not found'), httpErrors: httpErrorsFor('project not found'),
}) })
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment