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

Eurka set PollIntervalSeconds has Bug #71

Open
fuyulong133 opened this issue Mar 1, 2019 · 0 comments
Open

Eurka set PollIntervalSeconds has Bug #71

fuyulong133 opened this issue Mar 1, 2019 · 0 comments

Comments

@fuyulong133
Copy link

fuyulong133 commented Mar 1, 2019

at hargo latest version and golang at 1.10.3 , func UpdateApp() has a deadly bug,

func (e *EurekaConnection) UpdateApp(app *Application) {
go func() {
for {
log.Noticef("Updating app %s", app.Name)
err := e.readAppInto(app)
if err != nil {
log.Errorf("Failure updating %s in goroutine", app.Name)
}
<-time.After(time.Duration(e.PollInterval) * time.Second)
}
}()
}

func NewConnFromConfig(conf Config) (c EurekaConnection) {
c.ServiceUrls = conf.Eureka.ServiceUrls
c.ServicePort = conf.Eureka.ServerPort
if len(c.ServiceUrls) == 0 && len(conf.Eureka.ServerDNSName) > 0 {
c.ServiceUrls = []string{conf.Eureka.ServerDNSName}
}
c.Timeout = time.Duration(conf.Eureka.ConnectTimeoutSeconds) * time.Second
c.PollInterval = time.Duration(conf.Eureka.PollIntervalSeconds) * time.Second
c.PreferSameZone = conf.Eureka.PreferSameZone
if conf.Eureka.UseDNSForServiceUrls {
log.Warning("UseDNSForServiceUrls is an experimental option")
c.DNSDiscovery = true
c.DiscoveryZone = conf.Eureka.DNSDiscoveryZone
c.ServerURLBase = conf.Eureka.ServerURLBase
}
return c
}

The problem is <-time.After(time.Duration(e.PollInterval) * time.Second)

s := time.Duration(3) * time.Second
k := time.Duration(s) * time.Second
fmt.Println(s)
fmt.Println(k)

get
3s
833333h20m0s

so , they will be fixed to <-time.After(time.Duration(e.PollInterval))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant