Skip to content

Commit

Permalink
docgen: bump railroad diagram generation timeout to 120s
Browse files Browse the repository at this point in the history
Release note: None
  • Loading branch information
RichardJCai committed Apr 29, 2021
1 parent a513986 commit 49b83cb
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pkg/cmd/docgen/extract/extract.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"os/exec"
"regexp"
"strings"
"time"
"unicode"

"github.com/cockroachdb/cockroach/pkg/internal/rsg/yacc"
Expand Down Expand Up @@ -77,7 +78,8 @@ func GenerateRRNet(bnf []byte) ([]byte, error) {
v.Add("options", "factoring")
v.Add("options", "inline")

resp, err := httputil.Post(context.TODO(), rrAddr, "application/x-www-form-urlencoded", strings.NewReader(v.Encode()))
httpClient := httputil.NewClientWithTimeout(120 * time.Second)
resp, err := httpClient.Post(context.TODO(), rrAddr, "application/x-www-form-urlencoded", strings.NewReader(v.Encode()))
if err != nil {
return nil, err
}
Expand All @@ -98,7 +100,8 @@ func GenerateRRNet(bnf []byte) ([]byte, error) {
func GenerateBNF(addr string) (ebnf []byte, err error) {
var b []byte
if strings.HasPrefix(addr, "http") {
resp, err := httputil.Get(context.TODO(), addr)
httpClient := httputil.NewClientWithTimeout(120 * time.Second)
resp, err := httpClient.Get(context.TODO(), addr)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 49b83cb

Please sign in to comment.