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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
233cf070
Commit
233cf070
authored
Feb 25, 2018
by
Dylan Griffith
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove redundant code and increase delay for ClusterWaitForIngressIpAddressWorker (#42643)
parent
20897ebc
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
7 additions
and
10 deletions
+7
-10
app/models/clusters/applications/ingress.rb
app/models/clusters/applications/ingress.rb
+3
-4
app/workers/cluster_wait_for_ingress_ip_address_worker.rb
app/workers/cluster_wait_for_ingress_ip_address_worker.rb
+1
-3
spec/models/clusters/applications/ingress_spec.rb
spec/models/clusters/applications/ingress_spec.rb
+2
-2
spec/workers/cluster_wait_for_ingress_ip_address_worker_spec.rb
...orkers/cluster_wait_for_ingress_ip_address_worker_spec.rb
+1
-1
No files found.
app/models/clusters/applications/ingress.rb
View file @
233cf070
...
@@ -14,13 +14,13 @@ module Clusters
...
@@ -14,13 +14,13 @@ module Clusters
nginx:
1
nginx:
1
}
}
IP_ADDRESS_FETCH_RETRIES
=
3
FETCH_IP_ADDRESS_DELAY
=
30
.
seconds
state_machine
:status
do
state_machine
:status
do
before_transition
any
=>
[
:installed
]
do
|
application
|
before_transition
any
=>
[
:installed
]
do
|
application
|
application
.
run_after_commit
do
application
.
run_after_commit
do
ClusterWaitForIngressIpAddressWorker
.
perform_in
(
ClusterWaitForIngressIpAddressWorker
.
perform_in
(
ClusterWaitForIngressIpAddressWorker
::
INTERVAL
,
application
.
name
,
application
.
id
,
IP_ADDRESS_FETCH_RETRIES
)
FETCH_IP_ADDRESS_DELAY
,
application
.
name
,
application
.
id
)
end
end
end
end
end
end
...
@@ -41,8 +41,7 @@ module Clusters
...
@@ -41,8 +41,7 @@ module Clusters
return
unless
installed?
return
unless
installed?
return
if
external_ip
return
if
external_ip
ClusterWaitForIngressIpAddressWorker
.
perform_async
(
ClusterWaitForIngressIpAddressWorker
.
perform_async
(
name
,
id
)
name
,
id
,
IP_ADDRESS_FETCH_RETRIES
)
end
end
end
end
end
end
...
...
app/workers/cluster_wait_for_ingress_ip_address_worker.rb
View file @
233cf070
...
@@ -3,9 +3,7 @@ class ClusterWaitForIngressIpAddressWorker
...
@@ -3,9 +3,7 @@ class ClusterWaitForIngressIpAddressWorker
include
ClusterQueue
include
ClusterQueue
include
ClusterApplications
include
ClusterApplications
INTERVAL
=
30
.
seconds
def
perform
(
app_name
,
app_id
)
def
perform
(
app_name
,
app_id
,
retries_remaining
)
find_application
(
app_name
,
app_id
)
do
|
app
|
find_application
(
app_name
,
app_id
)
do
|
app
|
Clusters
::
Applications
::
CheckIngressIpAddressService
.
new
(
app
).
execute
Clusters
::
Applications
::
CheckIngressIpAddressService
.
new
(
app
).
execute
end
end
...
...
spec/models/clusters/applications/ingress_spec.rb
View file @
233cf070
...
@@ -20,7 +20,7 @@ describe Clusters::Applications::Ingress do
...
@@ -20,7 +20,7 @@ describe Clusters::Applications::Ingress do
it
'schedules a ClusterWaitForIngressIpAddressWorker'
do
it
'schedules a ClusterWaitForIngressIpAddressWorker'
do
expect
(
ClusterWaitForIngressIpAddressWorker
).
to
have_received
(
:perform_in
)
expect
(
ClusterWaitForIngressIpAddressWorker
).
to
have_received
(
:perform_in
)
.
with
(
Cluster
WaitForIngressIpAddressWorker
::
INTERVAL
,
'ingress'
,
application
.
id
,
3
)
.
with
(
Cluster
s
::
Applications
::
Ingress
::
FETCH_IP_ADDRESS_DELAY
,
'ingress'
,
application
.
id
)
end
end
end
end
...
@@ -33,7 +33,7 @@ describe Clusters::Applications::Ingress do
...
@@ -33,7 +33,7 @@ describe Clusters::Applications::Ingress do
it
'schedules a ClusterWaitForIngressIpAddressWorker'
do
it
'schedules a ClusterWaitForIngressIpAddressWorker'
do
expect
(
ClusterWaitForIngressIpAddressWorker
).
to
have_received
(
:perform_async
)
expect
(
ClusterWaitForIngressIpAddressWorker
).
to
have_received
(
:perform_async
)
.
with
(
'ingress'
,
application
.
id
,
3
)
.
with
(
'ingress'
,
application
.
id
)
end
end
context
'when the application is not installed'
do
context
'when the application is not installed'
do
...
...
spec/workers/cluster_wait_for_ingress_ip_address_worker_spec.rb
View file @
233cf070
...
@@ -22,7 +22,7 @@ describe ClusterWaitForIngressIpAddressWorker do
...
@@ -22,7 +22,7 @@ describe ClusterWaitForIngressIpAddressWorker do
end
end
it
'finds the application and calls CheckIngressIpAddressService#execute'
do
it
'finds the application and calls CheckIngressIpAddressService#execute'
do
worker
.
perform
(
'ingress'
,
117
,
2
)
worker
.
perform
(
'ingress'
,
117
)
expect
(
service
).
to
have_received
(
:execute
)
expect
(
service
).
to
have_received
(
:execute
)
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