MCPcopy Index your code
hub / github.com/cortexlabs/cortex / updateAPI

Method updateAPI

pkg/activator/activator.go:186–214  ·  view source on GitHub ↗
(oldObj interface{}, newObj interface{})

Source from the content-addressed store, hash-verified

184}
185
186func (a *activator) updateAPI(oldObj interface{}, newObj interface{}) {
187 apiMetadata, err := getAPIMeta(newObj)
188 if err != nil {
189 a.logger.Errorw("error during virtual service informer update callback", zap.Error(err))
190 telemetry.Error(err)
191 return
192 }
193
194 if apiMetadata.apiKind != userconfig.RealtimeAPIKind {
195 return
196 }
197
198 apiName := apiMetadata.apiName
199
200 oldAPIMetatada, err := getAPIMeta(oldObj)
201 if err != nil {
202 a.logger.Errorw("error during virtual service informer update callback", zap.Error(err))
203 telemetry.Error(err)
204 return
205 }
206
207 if oldAPIMetatada.maxConcurrency != apiMetadata.maxConcurrency || oldAPIMetatada.maxQueueLength != apiMetadata.maxQueueLength {
208 a.logger.Debugw("updating api activator", zap.String("apiName", apiName))
209
210 a.activatorsMux.Lock()
211 a.apiActivators[apiName].updateQueueParams(apiMetadata.maxQueueLength, apiMetadata.maxConcurrency)
212 a.activatorsMux.Unlock()
213 }
214}
215
216func (a *activator) removeAPI(obj interface{}) {
217 apiMetadata, err := getAPIMeta(obj)

Callers

nothing calls this directly

Calls 5

ErrorFunction · 0.92
getAPIMetaFunction · 0.85
ErrorMethod · 0.80
updateQueueParamsMethod · 0.80
StringMethod · 0.45

Tested by

no test coverage detected