Commit 73ac1007 authored by George Koltsov's avatar George Koltsov

Update Bulk Import default page size to 500

- Process 500 items intead of 100 at a time in order to reduce
  the amount of network requests made when running Bulk Import
parent 4816f7ef
...@@ -18,6 +18,8 @@ class BulkImports::Tracker < ApplicationRecord ...@@ -18,6 +18,8 @@ class BulkImports::Tracker < ApplicationRecord
validates :stage, presence: true validates :stage, presence: true
DEFAULT_PAGE_SIZE = 500
state_machine :status, initial: :created do state_machine :status, initial: :created do
state :created, value: 0 state :created, value: 0
state :started, value: 1 state :started, value: 1
......
---
title: Update BulkImport default page size to 500 in order to process larger page
of data
merge_request: 57594
author:
type: other
...@@ -9,10 +9,10 @@ module EE ...@@ -9,10 +9,10 @@ module EE
def to_s def to_s
<<-'GRAPHQL' <<-'GRAPHQL'
query($full_path: ID!, $epic_iid: ID!, $cursor: String) { query($full_path: ID!, $epic_iid: ID!, $cursor: String, $per_page: Int) {
group(fullPath: $full_path) { group(fullPath: $full_path) {
epic(iid: $epic_iid) { epic(iid: $epic_iid) {
award_emoji: awardEmoji(first: 100, after: $cursor) { award_emoji: awardEmoji(first: $per_page, after: $cursor) {
page_info: pageInfo { page_info: pageInfo {
end_cursor: endCursor end_cursor: endCursor
has_next_page: hasNextPage has_next_page: hasNextPage
...@@ -36,7 +36,8 @@ module EE ...@@ -36,7 +36,8 @@ module EE
{ {
full_path: context.entity.source_full_path, full_path: context.entity.source_full_path,
cursor: context.tracker.next_page, cursor: context.tracker.next_page,
epic_iid: iid epic_iid: iid,
per_page: ::BulkImports::Tracker::DEFAULT_PAGE_SIZE
} }
end end
......
...@@ -9,10 +9,10 @@ module EE ...@@ -9,10 +9,10 @@ module EE
def to_s def to_s
<<-'GRAPHQL' <<-'GRAPHQL'
query($full_path: ID!, $epic_iid: ID!, $cursor: String) { query($full_path: ID!, $epic_iid: ID!, $cursor: String, $per_page: Int) {
group(fullPath: $full_path) { group(fullPath: $full_path) {
epic(iid: $epic_iid) { epic(iid: $epic_iid) {
events(first: 100, after: $cursor) { events(first: $per_page, after: $cursor) {
page_info: pageInfo { page_info: pageInfo {
end_cursor: endCursor end_cursor: endCursor
has_next_page: hasNextPage has_next_page: hasNextPage
...@@ -38,7 +38,8 @@ module EE ...@@ -38,7 +38,8 @@ module EE
{ {
full_path: context.entity.source_full_path, full_path: context.entity.source_full_path,
cursor: context.tracker.next_page, cursor: context.tracker.next_page,
epic_iid: iid epic_iid: iid,
per_page: ::BulkImports::Tracker::DEFAULT_PAGE_SIZE
} }
end end
......
...@@ -9,11 +9,11 @@ module EE ...@@ -9,11 +9,11 @@ module EE
def to_s def to_s
<<-'GRAPHQL' <<-'GRAPHQL'
query($full_path: ID!, $cursor: String) { query($full_path: ID!, $cursor: String, $per_page: Int) {
group(fullPath: $full_path) { group(fullPath: $full_path) {
epics( epics(
includeDescendantGroups: false, includeDescendantGroups: false,
first: 100, first: $per_page,
after: $cursor after: $cursor
) { ) {
page_info: pageInfo { page_info: pageInfo {
...@@ -61,7 +61,8 @@ module EE ...@@ -61,7 +61,8 @@ module EE
def variables(context) def variables(context)
{ {
full_path: context.entity.source_full_path, full_path: context.entity.source_full_path,
cursor: context.tracker.next_page cursor: context.tracker.next_page,
per_page: ::BulkImports::Tracker::DEFAULT_PAGE_SIZE
} }
end end
......
...@@ -9,9 +9,9 @@ module EE ...@@ -9,9 +9,9 @@ module EE
def to_s def to_s
<<-'GRAPHQL' <<-'GRAPHQL'
query($full_path: ID!, $cursor: String) { query($full_path: ID!, $cursor: String, $per_page: Int) {
group(fullPath: $full_path) { group(fullPath: $full_path) {
iterations(first: 100, after: $cursor, includeAncestors: false) { iterations(first: $per_page, after: $cursor, includeAncestors: false) {
page_info: pageInfo { page_info: pageInfo {
end_cursor: endCursor end_cursor: endCursor
has_next_page: hasNextPage has_next_page: hasNextPage
...@@ -35,7 +35,8 @@ module EE ...@@ -35,7 +35,8 @@ module EE
def variables(context) def variables(context)
{ {
full_path: context.entity.source_full_path, full_path: context.entity.source_full_path,
cursor: context.tracker.next_page cursor: context.tracker.next_page,
per_page: ::BulkImports::Tracker::DEFAULT_PAGE_SIZE
} }
end end
......
...@@ -8,9 +8,9 @@ module BulkImports ...@@ -8,9 +8,9 @@ module BulkImports
def to_s def to_s
<<-'GRAPHQL' <<-'GRAPHQL'
query ($full_path: ID!, $cursor: String) { query ($full_path: ID!, $cursor: String, $per_page: Int) {
group(fullPath: $full_path) { group(fullPath: $full_path) {
labels(first: 100, after: $cursor, onlyGroupLabels: true) { labels(first: $per_page, after: $cursor, onlyGroupLabels: true) {
page_info: pageInfo { page_info: pageInfo {
end_cursor: endCursor end_cursor: endCursor
has_next_page: hasNextPage has_next_page: hasNextPage
...@@ -31,7 +31,8 @@ module BulkImports ...@@ -31,7 +31,8 @@ module BulkImports
def variables(context) def variables(context)
{ {
full_path: context.entity.source_full_path, full_path: context.entity.source_full_path,
cursor: context.tracker.next_page cursor: context.tracker.next_page,
per_page: ::BulkImports::Tracker::DEFAULT_PAGE_SIZE
} }
end end
......
...@@ -7,9 +7,9 @@ module BulkImports ...@@ -7,9 +7,9 @@ module BulkImports
extend self extend self
def to_s def to_s
<<-'GRAPHQL' <<-'GRAPHQL'
query($full_path: ID!, $cursor: String) { query($full_path: ID!, $cursor: String, $per_page: Int) {
group(fullPath: $full_path) { group(fullPath: $full_path) {
group_members: groupMembers(relations: DIRECT, first: 100, after: $cursor) { group_members: groupMembers(relations: DIRECT, first: $per_page, after: $cursor) {
page_info: pageInfo { page_info: pageInfo {
end_cursor: endCursor end_cursor: endCursor
has_next_page: hasNextPage has_next_page: hasNextPage
...@@ -34,7 +34,8 @@ module BulkImports ...@@ -34,7 +34,8 @@ module BulkImports
def variables(context) def variables(context)
{ {
full_path: context.entity.source_full_path, full_path: context.entity.source_full_path,
cursor: context.tracker.next_page cursor: context.tracker.next_page,
per_page: ::BulkImports::Tracker::DEFAULT_PAGE_SIZE
} }
end end
......
...@@ -8,9 +8,9 @@ module BulkImports ...@@ -8,9 +8,9 @@ module BulkImports
def to_s def to_s
<<-'GRAPHQL' <<-'GRAPHQL'
query ($full_path: ID!, $cursor: String) { query ($full_path: ID!, $cursor: String, $per_page: Int) {
group(fullPath: $full_path) { group(fullPath: $full_path) {
milestones(first: 100, after: $cursor, includeDescendants: false) { milestones(first: $per_page, after: $cursor, includeDescendants: false) {
page_info: pageInfo { page_info: pageInfo {
end_cursor: endCursor end_cursor: endCursor
has_next_page: hasNextPage has_next_page: hasNextPage
...@@ -33,7 +33,8 @@ module BulkImports ...@@ -33,7 +33,8 @@ module BulkImports
def variables(context) def variables(context)
{ {
full_path: context.entity.source_full_path, full_path: context.entity.source_full_path,
cursor: context.tracker.next_page cursor: context.tracker.next_page,
per_page: ::BulkImports::Tracker::DEFAULT_PAGE_SIZE
} }
end end
......
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