// Convenience func.  Launches a task list and waits for all tasks to complete.
// Returns an error if the launch fails (NOT if any of the tasks fail).
Convenience func.  Launches a task list and waits for all tasks to complete.
Returns an error if the launch fails (NOT if any of the tasks fail).
// Convenience func . Launches a task list and waits for all tasks to complete . // Returns an error if the launch fails ( NOT if any of the tasks fail ) .
func doOp(taskList []trsapi.HttpTask) error {
	rfClientLock.Lock()
	defer rfClientLock.Unlock()
	nTasks := 0
	for ii := 0; ii < len(taskList); ii++ {
		if taskList[ii].Ignore {
			continue
		}
		nTasks++
		err := popRFCreds(&taskList[ii])
		if err != nil {
			return fmt.Errorf("Error getting RF creds for '%s': %v",
				targFromTask(&taskList[ii]), err)
		}
	}
	if nTasks == 0 {
		logger.Debugf("doOp(): No tasks to perform, all ignored.")
		return nil
	}
	rchan, lerr := tloc.Launch(&taskList)
	if lerr != nil {
		logger.Errorf("Launch() failed: %v", lerr)
		return lerr
	}
	nDone := 0
	for {
		task := <-rchan
		logger.Debugf("Task complete, URL: '%s', status code: %d",
			task.Request.URL.Path, getStatusCode(task))
		nDone++
		if nDone >= nTasks {
			break
		}
	}
	tloc.Close(&taskList)
	return nil
}
func doOp ( taskList [ ] trsapi . HttpTask ) error { rfClientLock . Lock ( ) defer rfClientLock . Unlock ( ) nTasks := 0 for ii := 0 ; ii < len ( taskList ) ; ii ++ { if taskList [ ii ] . Ignore { continue } nTasks ++ err := popRFCreds ( & taskList [ ii ] ) if err != nil { return fmt . Errorf ( " " , targFromTask ( & taskList [ ii ] ) , err ) } } if nTasks == 0 { logger . Debugf ( " " ) return nil } rchan , lerr := tloc . Launch ( & taskList ) if lerr != nil { logger . Errorf ( " " , lerr ) return lerr } nDone := 0 for { task := <- rchan logger . Debugf ( " " , task . Request . URL . Path , getStatusCode ( task ) ) nDone ++ if nDone >= nTasks { break } } tloc . Close ( & taskList ) return nil }
Convenience func.
Convenience func .