Skip to content

Commit

Permalink
fix: a reconnected proxy will disappear from dashboard after 7 days (f…
Browse files Browse the repository at this point in the history
  • Loading branch information
harmy authored Sep 25, 2020
1 parent 3acf1bb commit ef5ae3e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pkg/metrics/mem/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ func (m *serverMetrics) clearUselessInfo() {
m.mu.Lock()
defer m.mu.Unlock()
for name, data := range m.info.ProxyStatistics {
if !data.LastCloseTime.IsZero() && time.Since(data.LastCloseTime) > time.Duration(7*24)*time.Hour {
if !data.LastCloseTime.IsZero() &&
data.LastStartTime.Before(data.LastCloseTime) &&
time.Since(data.LastCloseTime) > time.Duration(7*24)*time.Hour {
delete(m.info.ProxyStatistics, name)
log.Trace("clear proxy [%s]'s statistics data, lastCloseTime: [%s]", name, data.LastCloseTime.String())
}
Expand Down

0 comments on commit ef5ae3e

Please sign in to comment.