feat: add option to handle the overall request limit (#2209)

This commit is contained in:
Ludovic Fernandez 2024-06-13 22:48:04 +02:00 committed by GitHub
commit c63be848f6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 41 additions and 21 deletions

View file

@ -7,19 +7,10 @@ import (
"github.com/go-acme/lego/v4/log"
)
const (
// overallRequestLimit is the overall number of request per second
// limited on the "new-reg", "new-authz" and "new-cert" endpoints.
// From the documentation the limitation is 20 requests per second,
// but using 20 as value doesn't work but 18 do.
// https://letsencrypt.org/docs/rate-limits/
overallRequestLimit = 18
)
func (c *Certifier) getAuthorizations(order acme.ExtendedOrder) ([]acme.Authorization, error) {
resc, errc := make(chan acme.Authorization), make(chan domainError)
delay := time.Second / overallRequestLimit
delay := time.Second / time.Duration(c.overallRequestLimit)
for _, authzURL := range order.Authorizations {
time.Sleep(delay)