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
ec86ea7c
Commit
ec86ea7c
authored
Dec 17, 2020
by
Matija Čupić
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Spread runner CI minute reset to 8 hours
parent
ace3a8f4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
6 deletions
+7
-6
ee/app/workers/clear_shared_runners_minutes_worker.rb
ee/app/workers/clear_shared_runners_minutes_worker.rb
+2
-1
ee/spec/workers/clear_shared_runners_minutes_worker_spec.rb
ee/spec/workers/clear_shared_runners_minutes_worker_spec.rb
+5
-5
No files found.
ee/app/workers/clear_shared_runners_minutes_worker.rb
View file @
ec86ea7c
...
@@ -10,6 +10,7 @@ class ClearSharedRunnersMinutesWorker # rubocop:disable Scalability/IdempotentWo
...
@@ -10,6 +10,7 @@ class ClearSharedRunnersMinutesWorker # rubocop:disable Scalability/IdempotentWo
feature_category
:continuous_integration
feature_category
:continuous_integration
LEASE_TIMEOUT
=
3600
LEASE_TIMEOUT
=
3600
TIME_SPREAD
=
8
.
hours
.
seconds
.
freeze
BATCH_SIZE
=
100_000
BATCH_SIZE
=
100_000
def
perform
def
perform
...
@@ -17,7 +18,7 @@ class ClearSharedRunnersMinutesWorker # rubocop:disable Scalability/IdempotentWo
...
@@ -17,7 +18,7 @@ class ClearSharedRunnersMinutesWorker # rubocop:disable Scalability/IdempotentWo
start_id
=
Namespace
.
minimum
(
:id
)
start_id
=
Namespace
.
minimum
(
:id
)
last_id
=
Namespace
.
maximum
(
:id
)
last_id
=
Namespace
.
maximum
(
:id
)
execution_offset
=
3
.
hours
.
seconds
/
((
last_id
-
start_id
)
/
BATCH_SIZE
)
execution_offset
=
TIME_SPREAD
/
((
last_id
-
start_id
)
/
BATCH_SIZE
)
(
start_id
..
last_id
).
step
(
BATCH_SIZE
).
with_index
do
|
batch_start_id
,
batch_index
|
(
start_id
..
last_id
).
step
(
BATCH_SIZE
).
with_index
do
|
batch_start_id
,
batch_index
|
batch_end_id
=
batch_start_id
+
BATCH_SIZE
-
1
batch_end_id
=
batch_start_id
+
BATCH_SIZE
-
1
...
...
ee/spec/workers/clear_shared_runners_minutes_worker_spec.rb
View file @
ec86ea7c
...
@@ -147,12 +147,12 @@ RSpec.describe ClearSharedRunnersMinutesWorker do
...
@@ -147,12 +147,12 @@ RSpec.describe ClearSharedRunnersMinutesWorker do
end
end
it
'runs a worker per batch'
do
it
'runs a worker per batch'
do
# Spread evenly accross
3 hours (10
800 seconds)
# Spread evenly accross
8 hours (28
800 seconds)
expect
(
Ci
::
BatchResetMinutesWorker
).
to
receive
(
:perform_in
).
with
(
0
.
seconds
,
2
,
4
)
expect
(
Ci
::
BatchResetMinutesWorker
).
to
receive
(
:perform_in
).
with
(
0
.
seconds
,
2
,
4
)
expect
(
Ci
::
BatchResetMinutesWorker
).
to
receive
(
:perform_in
).
with
(
27
00
.
seconds
,
5
,
7
)
expect
(
Ci
::
BatchResetMinutesWorker
).
to
receive
(
:perform_in
).
with
(
72
00
.
seconds
,
5
,
7
)
expect
(
Ci
::
BatchResetMinutesWorker
).
to
receive
(
:perform_in
).
with
(
5
400
.
seconds
,
8
,
10
)
expect
(
Ci
::
BatchResetMinutesWorker
).
to
receive
(
:perform_in
).
with
(
14
400
.
seconds
,
8
,
10
)
expect
(
Ci
::
BatchResetMinutesWorker
).
to
receive
(
:perform_in
).
with
(
81
00
.
seconds
,
11
,
13
)
expect
(
Ci
::
BatchResetMinutesWorker
).
to
receive
(
:perform_in
).
with
(
216
00
.
seconds
,
11
,
13
)
expect
(
Ci
::
BatchResetMinutesWorker
).
to
receive
(
:perform_in
).
with
(
10
800
.
seconds
,
14
,
16
)
expect
(
Ci
::
BatchResetMinutesWorker
).
to
receive
(
:perform_in
).
with
(
28
800
.
seconds
,
14
,
16
)
subject
subject
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