(event *v1beta1.Event, clock clock.Clock)
| 146 | } |
| 147 | |
| 148 | func (e *eventBroadcasterImpl) recordToSink(event *v1beta1.Event, clock clock.Clock) { |
| 149 | // Make a copy before modification, because there could be multiple listeners. |
| 150 | eventCopy := event.DeepCopy() |
| 151 | go func() { |
| 152 | evToRecord := func() *v1beta1.Event { |
| 153 | e.mu.Lock() |
| 154 | defer e.mu.Unlock() |
| 155 | eventKey := getKey(eventCopy) |
| 156 | isomorphicEvent, isIsomorphic := e.eventCache[eventKey] |
| 157 | if isIsomorphic { |
| 158 | if isomorphicEvent.Series != nil { |
| 159 | isomorphicEvent.Series.Count++ |
| 160 | isomorphicEvent.Series.LastObservedTime = metav1.MicroTime{Time: clock.Now()} |
| 161 | return nil |
| 162 | } |
| 163 | isomorphicEvent.Series = &v1beta1.EventSeries{ |
| 164 | Count: 1, |
| 165 | LastObservedTime: metav1.MicroTime{Time: clock.Now()}, |
| 166 | } |
| 167 | return isomorphicEvent |
| 168 | } |
| 169 | e.eventCache[eventKey] = eventCopy |
| 170 | return eventCopy |
| 171 | }() |
| 172 | if evToRecord != nil { |
| 173 | recordedEvent := e.attemptRecording(evToRecord) |
| 174 | if recordedEvent != nil { |
| 175 | recordedEventKey := getKey(recordedEvent) |
| 176 | e.mu.Lock() |
| 177 | defer e.mu.Unlock() |
| 178 | e.eventCache[recordedEventKey] = recordedEvent |
| 179 | } |
| 180 | } |
| 181 | }() |
| 182 | } |
| 183 | |
| 184 | func (e *eventBroadcasterImpl) attemptRecording(event *v1beta1.Event) *v1beta1.Event { |
| 185 | tries := 0 |
no test coverage detected