finishSeries checks if a series has ended and either: - write final count to the apiserver - delete a singleton event (i.e. series field is nil) from the cache
()
| 121 | // - write final count to the apiserver |
| 122 | // - delete a singleton event (i.e. series field is nil) from the cache |
| 123 | func (e *eventBroadcasterImpl) finishSeries() { |
| 124 | // TODO: Investigate whether lock contention won't be a problem |
| 125 | e.mu.Lock() |
| 126 | defer e.mu.Unlock() |
| 127 | for isomorphicKey, event := range e.eventCache { |
| 128 | eventSerie := event.Series |
| 129 | if eventSerie != nil { |
| 130 | if eventSerie.LastObservedTime.Time.Before(time.Now().Add(-finishTime)) { |
| 131 | if _, retry := recordEvent(e.sink, event); !retry { |
| 132 | delete(e.eventCache, isomorphicKey) |
| 133 | } |
| 134 | } |
| 135 | } else if event.EventTime.Time.Before(time.Now().Add(-finishTime)) { |
| 136 | delete(e.eventCache, isomorphicKey) |
| 137 | } |
| 138 | } |
| 139 | } |
| 140 | |
| 141 | // NewRecorder returns an EventRecorder that records events with the given event source. |
| 142 | func (e *eventBroadcasterImpl) NewRecorder(scheme *runtime.Scheme, reportingController string) EventRecorder { |