Example #1
0
func (this *ReqJesgooModule) Run(inner_data *context.Context, bschan *chan bool) {
	defer func() {
		if len(inner_data.JesgooAds) == 0 {
			*bschan <- false
		} else {
			*bschan <- true
		}
	}()

	ch := make(chan bool)
	ret_ads := make([]context.AdInfo, 0)
	go this.ReqBs(inner_data, &ret_ads, &ch, Banner)

	inner_data.JesgooAds = make([]context.AdInfo, 0)
	select {
	case <-ch:
		for i := 0; i < len(ret_ads); i++ {
			if ret_ads[i].MaterialReady == true {
				inner_data.JesgooAds = append(inner_data.JesgooAds, ret_ads[i])
			}
		}
	case <-time.After(time.Millisecond * time.Duration(this.timeout)):
		utils.WarningLog.Write("req jesgoo bs timeout")
	}
	return
}