Skip to content

Commit

Permalink
new
Browse files Browse the repository at this point in the history
  • Loading branch information
xxjwxc committed Aug 21, 2021
1 parent a33099b commit 7377204
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
9 changes: 5 additions & 4 deletions registry/dns_naming_register.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,11 @@ func NewDNSNamingRegistry(opts ...Option) RegNaming {

func newDNSNamingRegistry(opts ...Option) RegNaming {
options := Options{
Context: context.Background(),
Timeout: time.Millisecond * 100,
NodeID: uuid.New().String(),
ServiceName: "gmsec.service",
Context: context.Background(),
Timeout: time.Millisecond * 100,
KeepHeartTimeout: time.Second * 15,
NodeID: uuid.New().String(),
ServiceName: "gmsec.service",
}
for _, o := range opts {
o(&options)
Expand Down
12 changes: 10 additions & 2 deletions registry/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ import (

// Options opts define
type Options struct {
Addrs []string
Timeout time.Duration
Addrs []string
Timeout time.Duration
KeepHeartTimeout time.Duration
// Secure bool
// TLSConfig *tls.Config
NodeID string
Expand Down Expand Up @@ -51,6 +52,13 @@ func WithTimeout(t time.Duration) Option {
}
}

// WithKeepHeartTimeout set heart timeout
func WithKeepHeartTimeout(t time.Duration) Option {
return func(o *Options) {
o.KeepHeartTimeout = t
}
}

// WithSecure communication with the registry
// func WithSecure(b bool) Option {
// return func(o *Options) {
Expand Down

0 comments on commit 7377204

Please sign in to comment.