ui/offering.go
func (h *Handler) PingOfferings(tkn string, ids []string) (map[string]bool, error) {
	logger := h.logger.Add("method", "PingOfferings", "ids", ids)

	if !h.token.Check(tkn) {
		logger.Warn("access denied")
		return nil, ErrAccessDenied
	}

	now := time.Now()
	ret := make(map[string]bool)

	wg := new(sync.WaitGroup)
	wg.Add(len(ids))
	for _, id := range ids {
		offering, err := h.findActiveOfferingByID(logger, id)
		if err != nil {
			return nil, err
		}
		go func(offering *data.Offering) {
			err := h.pingOffering(logger, offering)
			if err == nil {
				ret[offering.ID] = true
				offering.SOMCSuccessPing = &now
				err = update(logger, h.db.Querier, offering)
				if err != nil {
					logger.Warn(err.Error())
				}
			} else {
				ret[offering.ID] = false
				logger.Debug(err.Error())
			}
			wg.Done()
		}(offering)
	}
	wg.Wait()
	return ret, nil
}
func (h *Handler) PingOfferings(tkn string, ids []string) (map[string]bool, error) {
	logger := h.logger.Add("method", "PingOfferings", "ids", ids)

	if !h.token.Check(tkn) {
		logger.Warn("access denied")
		return nil, ErrAccessDenied
	}

	now := time.Now()
	ret := make(map[string]bool)

	wg := new(sync.WaitGroup)
	wg.Add(len(ids))
	for _, id := range ids {
		offering, err := h.findActiveOfferingByID(logger, id)
		if err != nil {
			return nil, err
		}
		go func(offering *data.Offering) {
			err := h.pingOffering(logger, offering)
			if err == nil {
				ret[offering.ID] = true
				offering.SOMCSuccessPing = &now
				err = update(logger, h.db.Querier, offering)
				if err != nil {
					logger.Warn(err.Error())
				}
			} else {
				ret[offering.ID] = false
				logger.Debug(err.Error())
			}
			wg.Done()
		}(offering)
	}
	wg.Wait()
	return ret, nil
}
// PingOfferings given offerings ids pings each of them and returns result of the test.