Skip to content
wais.go 60 KiB
Newer Older
Simon Pastor's avatar
Simon Pastor committed
			found = false
			for _, value := range values {
				if value == validQueryParamValue {
					found = true
					break
				}
			}
			if found {
				break
			}
		}
		if !found {
			log.Error("Query param not valid: ", queryParam)
			w.WriteHeader(http.StatusBadRequest)
			return
		}
	}

	response := createSubscriptionLinkList(subType)
Simon Pastor's avatar
Simon Pastor committed

	jsonResponse, err := json.Marshal(response)
	if err != nil {
		log.Error(err.Error())
		http.Error(w, err.Error(), http.StatusInternalServerError)
		return
	}
	w.WriteHeader(http.StatusOK)
	fmt.Fprintf(w, string(jsonResponse))
}

func cleanUp() {
	log.Info("Terminate all")
	rc.DBFlush(baseKey)
	nextSubscriptionIdAvailable = 1

	mutex.Lock()
	defer mutex.Unlock()

	assocStaSubscriptionInfoMap = map[int]*AssocStaSubscriptionInfo{}
	staDataRateSubscriptionInfoMap = map[int]*StaDataRateSubscriptionInfo{}
Simon Pastor's avatar
Simon Pastor committed

	subscriptionExpiryMap = map[int][]int{}
	updateStoreName("")
func updateStoreName(storeName string) {
Kevin Di Lallo's avatar
Kevin Di Lallo committed
	if currentStoreName != storeName {
		currentStoreName = storeName

Kevin Di Lallo's avatar
Kevin Di Lallo committed
		logComponent := moduleName
Kevin Di Lallo's avatar
Kevin Di Lallo committed
		if mepName != defaultMepName {
Kevin Di Lallo's avatar
Kevin Di Lallo committed
			logComponent = moduleName + "-" + mepName
Kevin Di Lallo's avatar
Kevin Di Lallo committed
		}
		err := httpLog.ReInit(logComponent, sandboxName, storeName, redisAddr, influxAddr)
		if err != nil {
			log.Error("Failed to initialise httpLog: ", err)
			return
		}
Simon Pastor's avatar
Simon Pastor committed
	}