Commit 1abc60fe authored by Vladimir Shushlin's avatar Vladimir Shushlin

Don't schedule retry worker if acme order present

parent 201dd61b
......@@ -10,7 +10,9 @@ module PagesDomains
def execute
pages_domain.update!(auto_ssl_failed: false)
PagesDomainSslRenewalWorker.perform_async(pages_domain.id)
# Don't schedule worker if already have acme order to prevent users from abusing retries
PagesDomainSslRenewalWorker.perform_async(pages_domain.id) unless pages_domain.acme_orders.exists?
end
end
end
......@@ -18,4 +18,12 @@ describe PagesDomains::RetryAcmeOrderService do
service.execute
end
it "doesn't schedule renewal worker if acme order is already present" do
create(:pages_domain_acme_order, pages_domain: domain)
expect(PagesDomainSslRenewalWorker).not_to receive(:new)
service.execute
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