Commit 1b115904 authored by Martin Wortschack's avatar Martin Wortschack

Merge branch 'reduce-query-overhead-for-mr-count' into 'master'

Do not load MR records when requesting counts

See merge request gitlab-org/gitlab!40339
parents e7d96fd0 a842dc48
...@@ -19,7 +19,9 @@ export default (startDate = null, endDate = null) => { ...@@ -19,7 +19,9 @@ export default (startDate = null, endDate = null) => {
const computedMonthData = monthData.map(value => { const computedMonthData = monthData.map(value => {
const { year, month, mergedAfter, mergedBefore } = value; const { year, month, mergedAfter, mergedBefore } = value;
return `${month}_${year}: mergeRequests(mergedBefore: "${mergedBefore}", mergedAfter: "${mergedAfter}") { count }`; // first: 0 is an optimization which makes sure we don't load merge request objects into memory (backend).
// Currently when requesting counts we also load the first 100 records (preloader problem).
return `${month}_${year}: mergeRequests(first: 0, mergedBefore: "${mergedBefore}", mergedAfter: "${mergedAfter}") { count }`;
}); });
return gql` return gql`
......
...@@ -33,13 +33,13 @@ export const expectedMonthData = [ ...@@ -33,13 +33,13 @@ export const expectedMonthData = [
export const throughputChartQuery = `query ($fullPath: ID!) { export const throughputChartQuery = `query ($fullPath: ID!) {
throughputChartData: project(fullPath: $fullPath) { throughputChartData: project(fullPath: $fullPath) {
May_2020: mergeRequests(mergedBefore: "2020-06-01", mergedAfter: "2020-05-01") { May_2020: mergeRequests(first: 0, mergedBefore: "2020-06-01", mergedAfter: "2020-05-01") {
count count
} }
Jun_2020: mergeRequests(mergedBefore: "2020-07-01", mergedAfter: "2020-06-01") { Jun_2020: mergeRequests(first: 0, mergedBefore: "2020-07-01", mergedAfter: "2020-06-01") {
count count
} }
Jul_2020: mergeRequests(mergedBefore: "2020-08-01", mergedAfter: "2020-07-01") { Jul_2020: mergeRequests(first: 0, mergedBefore: "2020-08-01", mergedAfter: "2020-07-01") {
count count
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment