// Package pool define concurrency call function in ants package pool import ( "context" "time" "modelRT/config" "modelRT/database" "modelRT/diagram" "modelRT/logger" ) // ParseFunc defines func that parses the model data from postgres var ParseFunc = func(parseConfig interface{}) { modelParseConfig, ok := parseConfig.(config.ModelParseConfig) if !ok { logger.Error(modelParseConfig.Ctx, "conversion model parse config type failed") return } cancelCtx, cancel := context.WithTimeout(modelParseConfig.Ctx, 5*time.Second) defer cancel() pgClient := database.GetPostgresDBClient() component, err := database.QueryComponentByUUID(cancelCtx, pgClient, modelParseConfig.ComponentInfo.GlobalUUID) if err != nil { logger.Error(modelParseConfig.Ctx, "query component info failed", "error", err) return } diagram.StoreAnchorValue(modelParseConfig.ComponentInfo.GlobalUUID.String(), "") GetAnchorParamChan(modelParseConfig.Ctx, modelParseConfig.ComponentInfo.GlobalUUID.String()) diagram.StoreComponentMap(modelParseConfig.ComponentInfo.GlobalUUID.String(), &component) return }