func (sc ServiceChecks) SplitPayload(times int) ([]marshaler.Marshaler, error) {
	serviceCheckExpvar.Add("TimesSplit", 1)
	tlmServiceCheck.Inc("times_split")
	// only split it up as much as possible
	if len(sc) < times {
		serviceCheckExpvar.Add("ServiceChecksShorter", 1)
		tlmServiceCheck.Inc("shorter")
		times = len(sc)
	}
	splitPayloads := make([]marshaler.Marshaler, times)
	batchSize := len(sc) / times
	n := 0
	for i := 0; i < times; i++ {
		var end int
		// the batch size will not be perfect, only split it as much as possible
		if i < times-1 {
			end = n + batchSize
		} else {
			end = len(sc)
		}
		newSC := sc[n:end]
		splitPayloads[i] = newSC
		n += batchSize
	}
	return splitPayloads, nil
}
// SplitPayload breaks the payload into times number of pieces
SplitPayload breaks the payload into times number of pieces
// SplitPayload breaks the payload into times number of pieces
func (sc ServiceChecks) SplitPayload(times int) ([]marshaler.Marshaler, error) {
	serviceCheckExpvar.Add("TimesSplit", 1)
	tlmServiceCheck.Inc("times_split")
	if len(sc) < times {
		serviceCheckExpvar.Add("ServiceChecksShorter", 1)
		tlmServiceCheck.Inc("shorter")
		times = len(sc)
	}
	splitPayloads := make([]marshaler.Marshaler, times)
	batchSize := len(sc) / times
	n := 0
	for i := 0; i < times; i++ {
		var end int
		if i < times-1 {
			end = n + batchSize
		} else {
			end = len(sc)
		}
		newSC := sc[n:end]
		splitPayloads[i] = newSC
		n += batchSize
	}
	return splitPayloads, nil
}
func ( sc ServiceChecks ) SplitPayload ( times int ) ( [ ] marshaler . Marshaler , error ) { serviceCheckExpvar . Add ( " " , 1 ) tlmServiceCheck . Inc ( " " ) if len ( sc ) < times { serviceCheckExpvar . Add ( " " , 1 ) tlmServiceCheck . Inc ( " " ) times = len ( sc ) } splitPayloads := make ( [ ] marshaler . Marshaler , times ) batchSize := len ( sc ) / times n := 0 for i := 0 ; i < times ; i ++ { var end int if i < times - 1 { end = n + batchSize } else { end = len ( sc ) } newSC := sc [ n : end ] splitPayloads [ i ] = newSC n += batchSize } return splitPayloads , nil }
SplitPayload breaks the payload into times number of pieces
SplitPayload breaks the payload into times number of pieces
// only split it up as much as possible // the batch size will not be perfect, only split it as much as possible