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
b27ed1b9
Commit
b27ed1b9
authored
Apr 07, 2020
by
Vladimir Shushlin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't retry acme orders if auto_ssl is not enabled or not failed yet
parent
fb2215f1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
5 deletions
+16
-5
app/services/pages_domains/retry_acme_order_service.rb
app/services/pages_domains/retry_acme_order_service.rb
+6
-3
spec/services/pages_domains/retry_acme_order_service_spec.rb
spec/services/pages_domains/retry_acme_order_service_spec.rb
+10
-2
No files found.
app/services/pages_domains/retry_acme_order_service.rb
View file @
b27ed1b9
...
@@ -9,10 +9,13 @@ module PagesDomains
...
@@ -9,10 +9,13 @@ module PagesDomains
end
end
def
execute
def
execute
pages_domain
.
update!
(
auto_ssl_failed:
false
)
updated
=
pages_domain
.
with_lock
do
next
unless
pages_domain
.
auto_ssl_enabled
&&
pages_domain
.
auto_ssl_failed
# Don't schedule worker if already have acme order to prevent users from abusing retries
pages_domain
.
update!
(
auto_ssl_failed:
false
)
PagesDomainSslRenewalWorker
.
perform_async
(
pages_domain
.
id
)
unless
pages_domain
.
acme_orders
.
exists?
end
PagesDomainSslRenewalWorker
.
perform_async
(
pages_domain
.
id
)
if
updated
end
end
end
end
end
end
spec/services/pages_domains/retry_acme_order_service_spec.rb
View file @
b27ed1b9
...
@@ -19,8 +19,16 @@ describe PagesDomains::RetryAcmeOrderService do
...
@@ -19,8 +19,16 @@ describe PagesDomains::RetryAcmeOrderService do
service
.
execute
service
.
execute
end
end
it
"doesn't schedule renewal worker if acme order is already present"
do
it
"doesn't schedule renewal worker if Let's Encrypt integration is not enabled"
do
create
(
:pages_domain_acme_order
,
pages_domain:
domain
)
domain
.
update!
(
auto_ssl_enabled:
false
)
expect
(
PagesDomainSslRenewalWorker
).
not_to
receive
(
:new
)
service
.
execute
end
it
"doesn't schedule renewal worker if auto ssl has not failed yet"
do
domain
.
update!
(
auto_ssl_failed:
false
)
expect
(
PagesDomainSslRenewalWorker
).
not_to
receive
(
:new
)
expect
(
PagesDomainSslRenewalWorker
).
not_to
receive
(
:new
)
...
...
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