MCPcopy Create free account
hub / github.com/baidu/EasyFaaS / stopRuntime

Method stopRuntime

pkg/controller/rtctrl/runtime.go:355–389  ·  view source on GitHub ↗

stopRuntime

()

Source from the content-addressed store, hash-verified

353
354// stopRuntime
355func (info *RuntimeInfo) stopRuntime() {
356 info.invokeLock.Lock()
357 defer info.invokeLock.Unlock()
358
359 logs.V(5).Infof("close runtime %s", info.RuntimeID)
360
361 info.PreLoadTimeMS = 0
362 info.PostLoadTimeMS = 0
363 info.PreInitTimeMS = 0
364 info.PostInitTimeMS = 0
365 info.AcceptReqCnt = 0
366 info.RejectReqCnt = 0
367 info.Concurrency = 0
368
369 info.requestMap.Range(func(key, value interface{}) bool {
370 id := key.(string)
371 request := value.(*RequestInfo)
372 request.InvokeResult(StatusFailed, fmt.Sprintf("RequestID: %s Process exited before completing request", id))
373 request.Notify()
374 return true
375 })
376 info.requestMap = sync.Map{}
377 close(info.runtimeStopChan)
378 if !info.WithStreamMode {
379 info.runtimeConn.Close()
380 } else {
381 info.httpClient = nil
382 }
383 info.runtimeWaitGroup.Wait()
384 info.updateStreamMode(false)
385
386 info.SetState(RuntimeStateStopped)
387
388 info.runtimeRunChan = make(chan struct{})
389}
390
391// InvokeFunc
392func (info *RuntimeInfo) InvokeFunc(request *RequestInfo, invokeReq *InvokeRequest) error {

Callers 2

sendHTTPRequestLoopMethod · 0.95

Calls 9

updateStreamModeMethod · 0.95
SetStateMethod · 0.95
VFunction · 0.92
LockMethod · 0.80
InfofMethod · 0.80
InvokeResultMethod · 0.80
NotifyMethod · 0.80
CloseMethod · 0.65
WaitMethod · 0.65

Tested by

no test coverage detected