MCPcopy
hub / github.com/keploy/keploy / Stop

Function Stop

utils/ctx.go:137–157  ·  view source on GitHub ↗

Stop requires a reason to stop the server. this is to ensure that the server is not stopped accidentally. and to trace back the stopper

(logger *zap.Logger, reason string)

Source from the content-addressed store, hash-verified

135// this is to ensure that the server is not stopped accidentally.
136// and to trace back the stopper
137func Stop(logger *zap.Logger, reason string) error {
138 // Stop the server.
139 if logger == nil {
140 return errors.New("logger is not set")
141 }
142 if cancel == nil {
143 err := errors.New("cancel function is not set")
144 LogError(logger, err, "failed stopping keploy")
145 return err
146 }
147
148 if reason == "" {
149 err := errors.New("cannot stop keploy without a reason")
150 LogError(logger, err, "failed stopping keploy")
151 return err
152 }
153
154 logger.Info("stopping Keploy", zap.String("reason", reason))
155 ExecCancel()
156 return nil
157}
158
159func ExecCancel() {
160 cancel()

Callers 3

StartMethod · 0.92
StopMethod · 0.92
RecoverFunction · 0.85

Calls 4

LogErrorFunction · 0.85
ExecCancelFunction · 0.85
NewMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected