mirror of https://github.com/golang/go.git
internal/event: fix the agent start time
The current use of start time in the cache key prevents re-use of agents under some circumstances, so we update it later in the exporter instead. Change-Id: I2f6927d65a0841f77a0ee1b848b5a3b243936083 Reviewed-on: https://go-review.googlesource.com/c/tools/+/231257 Run-TryBot: Ian Cottrell <iancottrell@google.com> Reviewed-by: Robert Findley <rfindley@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
f26c0dd982
commit
d351ea090f
|
|
@ -66,9 +66,6 @@ func Connect(config *Config) *Exporter {
|
|||
return nil
|
||||
}
|
||||
resolved := *config
|
||||
if resolved.Start.IsZero() {
|
||||
resolved.Start = time.Now()
|
||||
}
|
||||
if resolved.Host == "" {
|
||||
hostname, _ := os.Hostname()
|
||||
resolved.Host = hostname
|
||||
|
|
@ -93,6 +90,9 @@ func Connect(config *Config) *Exporter {
|
|||
}
|
||||
exporter := &Exporter{config: resolved}
|
||||
exporters[resolved] = exporter
|
||||
if exporter.config.Start.IsZero() {
|
||||
exporter.config.Start = time.Now()
|
||||
}
|
||||
go func() {
|
||||
for range time.Tick(exporter.config.Rate) {
|
||||
exporter.Flush()
|
||||
|
|
|
|||
Loading…
Reference in New Issue