Commit a842dc48 authored by Adam Hegyi's avatar Adam Hegyi

Do not load MR records when requesting counts

This change adds `first: 0` to the throughput analytics count query to
avoid loading MR records into memory. Due to a preloader issue, even if
only the count is requested, the first 100 records are going to be
loaded. By specifying 0, the query will be still executed, however it
will be evaluated as no-op.
parent aeac7c0e
......@@ -19,7 +19,9 @@ export default (startDate = null, endDate = null) => {
const computedMonthData = monthData.map(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`
......
......@@ -33,13 +33,13 @@ export const expectedMonthData = [
export const throughputChartQuery = `query ($fullPath: ID!) {
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
}
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
}
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
}
}
......
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