Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Respect DNS TTL #1085

Closed
wants to merge 14 commits into from
  •  
  •  
  •  
245 changes: 36 additions & 209 deletions Gopkg.lock

Large diffs are not rendered by default.

8 changes: 5 additions & 3 deletions js/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import (
"strconv"
"time"

"github.com/domainr/dnsr"
"github.com/dop251/goja"
"github.com/loadimpact/k6/js/common"
"github.com/loadimpact/k6/lib"
Expand All @@ -39,7 +40,6 @@ import (
"github.com/pkg/errors"
log "github.com/sirupsen/logrus"
"github.com/spf13/afero"
"github.com/viki-org/dnscache"
"golang.org/x/net/http2"
"golang.org/x/time/rate"
)
Expand All @@ -55,7 +55,7 @@ type Runner struct {
defaultGroup *lib.Group

BaseDialer net.Dialer
Resolver *dnscache.Resolver
Resolver *dnsr.Resolver
RPSLimit *rate.Limiter

console *console
Expand Down Expand Up @@ -94,7 +94,7 @@ func NewFromBundle(b *Bundle) (*Runner, error) {
DualStack: true,
},
console: newConsole(),
Resolver: dnscache.New(0),
Resolver: dnsr.NewExpiring(0),
}

err = r.SetOptions(r.Bundle.Options)
Expand Down Expand Up @@ -147,6 +147,8 @@ func (r *Runner) newVU(samplesOut chan<- stats.SampleContainer) (*VU, error) {
dialer := &netext.Dialer{
Dialer: r.BaseDialer,
Resolver: r.Resolver,
IP4: make(map[string]bool),
CNAME: make(map[string]netext.CanonicalName),
Blacklist: r.Bundle.Options.BlacklistIPs,
Hosts: r.Bundle.Options.Hosts,
}
Expand Down
Loading