code: func (nodeInfo *NodeInfo) countRecentFailures(now time.Time, t *api.Task) int {
  	versionedService := versionedService{serviceID: t.ServiceID}
  	if t.SpecVersion != nil {
  		versionedService.specVersion = *t.SpecVersion
  	}
  
  	recentFailureCount := len(nodeInfo.recentFailures[versionedService])
  	for i := recentFailureCount - 1; i >= 0; i-- {
  		if now.Sub(nodeInfo.recentFailures[versionedService][i]) > monitorFailures {
  			recentFailureCount -= i + 1
  			break
  		}
  	}
  
  	return recentFailureCount
  }
docs: // countRecentFailures returns the number of times the service has failed on
  // this node within the lookback window monitorFailures.