func MainLoop() { for { conditions := make([]*model.Condition, 0) conditions = append(conditions, model.NewCondition("group_uuid", "=", "")) conditions = append(conditions, model.NewCondition("end_ts", "!=", "0")) order := model.NewOrder("begin_ts", "asc") process(model.ListRequest(conditions, order, nil)) time.Sleep(5 * time.Second) } }
func GetRequestChildren(w http.ResponseWriter, r *http.Request) { vars := mux.Vars(r) uuid := vars["uuid"] conditions := make([]*model.Condition, 0) conditions = append(conditions, model.NewCondition("parent_uuid", "=", uuid)) rs := model.ListRequest(conditions, nil, nil) json.NewEncoder(w).Encode(rs) }
func GetInvokeChain(w http.ResponseWriter, r *http.Request) { vars := mux.Vars(r) service := vars["service"] category := vars["category"] id := vars["id"] st := model.RequestType{ Service: service, Category: category, } conditions := make([]*model.Condition, 0) conditions = append(conditions, model.NewCondition("header", "=", model.RequestType2string(&st))) conditions = append(conditions, model.NewCondition("id", "=", id)) ivkchains := model.ListInvokeChain(conditions, nil, nil) if len(ivkchains) == 0 { w.WriteHeader(http.StatusNotFound) return } json.NewEncoder(w).Encode(ivkchains[0]) }
func GetInvokeChains(w http.ResponseWriter, r *http.Request) { vars := mux.Vars(r) service := vars["service"] category := vars["category"] st := model.RequestType{ Service: service, Category: category, } conditions := make([]*model.Condition, 0) conditions = append(conditions, model.NewCondition("header", "=", model.RequestType2string(&st))) ivkchains := model.ListInvokeChain(conditions, nil, nil) json.NewEncoder(w).Encode(ivkchains) }