| 74 | } |
| 75 | |
| 76 | func (e *ecuStats) runOnce() { |
| 77 | log.Info("Updating ECU statistics from Seesaw Engine...") |
| 78 | start := time.Now() |
| 79 | s, err := e.stats() |
| 80 | if err != nil { |
| 81 | log.Warningf("Couldn't update statistics: %v", err) |
| 82 | s = e.lastStats |
| 83 | } |
| 84 | s.LastUpdate = start |
| 85 | e.lastStats = s |
| 86 | e.publishersMu.RLock() |
| 87 | defer e.publishersMu.RUnlock() |
| 88 | for _, p := range e.publishers { |
| 89 | t := *s |
| 90 | p.Update(&t) |
| 91 | } |
| 92 | } |
| 93 | |
| 94 | // run attempts to update the cached statistics from the Seesaw Engine at |
| 95 | // regular intervals. |