MCPcopy
hub / github.com/cortexlabs/cortex / addAPI

Method addAPI

pkg/activator/activator.go:162–184  ·  view source on GitHub ↗
(obj interface{})

Source from the content-addressed store, hash-verified

160}
161
162func (a *activator) addAPI(obj interface{}) {
163 apiMetadata, err := getAPIMeta(obj)
164 if err != nil {
165 a.logger.Errorw("error during virtual service informer add callback", zap.Error(err))
166 telemetry.Error(err)
167 return
168 }
169
170 if apiMetadata.apiKind != userconfig.RealtimeAPIKind {
171 return
172 }
173
174 apiName := apiMetadata.apiName
175
176 a.activatorsMux.Lock()
177 if a.apiActivators[apiName] == nil {
178 a.logger.Debugw("adding new api activator", zap.String("apiName", apiName))
179 a.apiActivators[apiName] = newAPIActivator(apiMetadata.maxQueueLength, apiMetadata.maxConcurrency)
180 }
181 a.activatorsMux.Unlock()
182
183 a.reporter.AddAPI(apiName)
184}
185
186func (a *activator) updateAPI(oldObj interface{}, newObj interface{}) {
187 apiMetadata, err := getAPIMeta(newObj)

Callers

nothing calls this directly

Calls 6

ErrorFunction · 0.92
getAPIMetaFunction · 0.85
newAPIActivatorFunction · 0.85
ErrorMethod · 0.80
AddAPIMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected