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

Method Do

pkg/controller/invoke.go:48–80  ·  view source on GitHub ↗
(ctx *InvokeContext)

Source from the content-addressed store, hash-verified

46)
47
48func (controller *Controller) Do(ctx *InvokeContext) {
49 var err error
50 defer func() {
51 if r := recover(); r != nil {
52 var buf [4096]byte
53 runtime.Stack(buf[:], true)
54 ctx.Logger.Errorf("Panic recovered in do, %+v | %s", r, string(buf[:]))
55 err = fmt.Errorf("%+v", r)
56 }
57 if err != nil {
58 buildErrorResponse(ctx, err)
59 }
60 }()
61 defer controller.SummaryMetrics(ctx)
62
63 ctx.Logger.V(3).Infof("start to invoke request %s", ctx.RequestID)
64
65 if _, err = controller.getFunction(ctx); err != nil {
66 return
67 }
68
69 if _, err = controller.getRuntimeConfiguration(ctx); err != nil {
70 return
71 }
72
73 if err = controller.getRuntime(ctx); err != nil {
74 return
75 }
76 defer controller.putRuntime(ctx)
77
78 controller.invocation(ctx)
79 controller.buildResponse(ctx, ctx.Output.Output)
80}
81
82func buildErrorResponse(ctx *InvokeContext, err error) {
83 var status int

Callers 1

InvokeMethod · 0.95

Calls 11

SummaryMetricsMethod · 0.95
getFunctionMethod · 0.95
getRuntimeMethod · 0.95
putRuntimeMethod · 0.95
invocationMethod · 0.95
buildResponseMethod · 0.95
buildErrorResponseFunction · 0.85
ErrorfMethod · 0.80
InfofMethod · 0.80
VMethod · 0.80

Tested by

no test coverage detected