mirror of
https://github.com/go-acme/lego
synced 2026-03-14 14:35:48 +01:00
cli/renew: skip random sleep if stdout is a terminal (#1659)
This commit is contained in:
parent
85f616f85b
commit
3e9e6ac847
3 changed files with 11 additions and 6 deletions
|
|
@ -4,12 +4,14 @@ import (
|
|||
"crypto"
|
||||
"crypto/x509"
|
||||
"math/rand"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/go-acme/lego/v4/certcrypto"
|
||||
"github.com/go-acme/lego/v4/certificate"
|
||||
"github.com/go-acme/lego/v4/lego"
|
||||
"github.com/go-acme/lego/v4/log"
|
||||
"github.com/mattn/go-isatty"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
|
|
@ -137,8 +139,9 @@ func renewForDomains(ctx *cli.Context, client *lego.Client, certsStorage *Certif
|
|||
}
|
||||
}
|
||||
|
||||
if !ctx.Bool("no-random-sleep") {
|
||||
// https://github.com/go-acme/lego/issues/1656
|
||||
// https://github.com/go-acme/lego/issues/1656
|
||||
// https://github.com/certbot/certbot/blob/284023a1b7672be2bd4018dd7623b3b92197d4b0/certbot/certbot/_internal/renewal.py#L435-L440
|
||||
if !isatty.IsTerminal(os.Stdout.Fd()) && !ctx.Bool("no-random-sleep") {
|
||||
// https://github.com/certbot/certbot/blob/284023a1b7672be2bd4018dd7623b3b92197d4b0/certbot/certbot/_internal/renewal.py#L472
|
||||
const jitter = 8 * time.Minute
|
||||
rnd := rand.New(rand.NewSource(time.Now().UnixNano()))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue