Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
7c7a90da
Commit
7c7a90da
authored
Mar 06, 2021
by
Alexandru Croitor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move batch size to a constant
parent
5492f611
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
app/services/issue_rebalancing_service.rb
app/services/issue_rebalancing_service.rb
+3
-2
No files found.
app/services/issue_rebalancing_service.rb
View file @
7c7a90da
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
class
IssueRebalancingService
class
IssueRebalancingService
MAX_ISSUE_COUNT
=
10_000
MAX_ISSUE_COUNT
=
10_000
BATCH_SIZE
=
100
TooManyIssues
=
Class
.
new
(
StandardError
)
TooManyIssues
=
Class
.
new
(
StandardError
)
def
initialize
(
issue
)
def
initialize
(
issue
)
...
@@ -21,13 +22,13 @@ class IssueRebalancingService
...
@@ -21,13 +22,13 @@ class IssueRebalancingService
Issue
.
transaction
do
Issue
.
transaction
do
assign_positions
(
start
,
indexed_ids
)
assign_positions
(
start
,
indexed_ids
)
.
sort_by
(
&
:first
)
.
sort_by
(
&
:first
)
.
each_slice
(
100
)
do
|
pairs_with_position
|
.
each_slice
(
BATCH_SIZE
)
do
|
pairs_with_position
|
update_positions
(
pairs_with_position
,
'rebalance issue positions in batches ordered by id'
)
update_positions
(
pairs_with_position
,
'rebalance issue positions in batches ordered by id'
)
end
end
end
end
else
else
Issue
.
transaction
do
Issue
.
transaction
do
indexed_ids
.
each_slice
(
100
)
do
|
pairs
|
indexed_ids
.
each_slice
(
BATCH_SIZE
)
do
|
pairs
|
pairs_with_position
=
assign_positions
(
start
,
pairs
)
pairs_with_position
=
assign_positions
(
start
,
pairs
)
update_positions
(
pairs_with_position
,
'rebalance issue positions'
)
update_positions
(
pairs_with_position
,
'rebalance issue positions'
)
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment