code: func (a *aggregator) notify(oldEvents map[string]*aggregatedEvent, out chan<- []string) {
  	timeBeforeSending := time.Now()
  	l.Debugf("%v Notifying about %d fs events", a, len(oldEvents))
  	separatedBatches := make(map[fs.EventType][]string)
  	for path, event := range oldEvents {
  		separatedBatches[event.evType] = append(separatedBatches[event.evType], path)
  	}
  	for _, evType := range [3]fs.EventType{fs.NonRemove, fs.Mixed, fs.Remove} {
  		currBatch := separatedBatches[evType]
  		if len(currBatch) != 0 {
  			select {
  			case out <- currBatch:
  			case <-a.ctx.Done():
  				return
  			}
  		}
  	}
  	// If sending to channel blocked for a long time,
  	// shorten next notifyDelay accordingly.
  	duration := time.Since(timeBeforeSending)
  	buffer := time.Millisecond
  	var nextDelay time.Duration
  	switch {
  	case duration < a.notifyDelay/10:
  		nextDelay = a.notifyDelay
  	case duration+buffer > a.notifyDelay:
  		nextDelay = buffer
  	default:
  		nextDelay = a.notifyDelay - duration
  	}
  	select {
  	case a.notifyTimerResetChan <- nextDelay:
  	case <-a.ctx.Done():
  	}
  }
docs: // Schedule scan for given events dispatching deletes last and reset notification
  // afterwards to set up for the next scan scheduling.