code: func (endpointsMap EndpointsMap) apply(changes *EndpointChangeTracker, staleEndpoints *[]ServiceEndpoint,
  	staleServiceNames *[]ServicePortName, lastChangeTriggerTimes *[]time.Time) {
  	if changes == nil {
  		return
  	}
  	changes.lock.Lock()
  	defer changes.lock.Unlock()
  	for _, change := range changes.items {
  		endpointsMap.Unmerge(change.previous)
  		endpointsMap.Merge(change.current)
  		detectStaleConnections(change.previous, change.current, staleEndpoints, staleServiceNames)
  	}
  	changes.items = make(map[types.NamespacedName]*endpointsChange)
  	for _, lastChangeTriggerTime := range changes.lastChangeTriggerTimes {
  		*lastChangeTriggerTimes = append(*lastChangeTriggerTimes, lastChangeTriggerTime...)
  	}
  	changes.lastChangeTriggerTimes = make(map[types.NamespacedName][]time.Time)
  }
docs: // apply the changes to EndpointsMap and updates stale endpoints and service-endpoints pair. The `staleEndpoints` argument
  // is passed in to store the stale udp endpoints and `staleServiceNames` argument is passed in to store the stale udp service.
  // The changes map is cleared after applying them.
  // In addition it returns (via argument) and resets the lastChangeTriggerTimes for all endpoints
  // that were changed and will result in syncing the proxy rules.