MCPcopy Index your code
hub / github.com/netdata/netdata / parsePayloadTimeout

Function parsePayloadTimeout

src/go/cmd/godplugin/main.go:277–304  ·  view source on GitHub ↗
(payload map[string]any)

Source from the content-addressed store, hash-verified

275}
276
277func parsePayloadTimeout(payload map[string]any) (int64, bool, error) {
278 if payload == nil {
279 return 0, false, nil
280 }
281 raw, ok := payload["timeout"]
282 if !ok {
283 return 0, false, nil
284 }
285 switch v := raw.(type) {
286 case float64:
287 return int64(v), true, nil
288 case int:
289 return int64(v), true, nil
290 case int64:
291 return v, true, nil
292 case string:
293 if v == "" {
294 return 0, false, nil
295 }
296 n, err := strconv.ParseInt(v, 10, 64)
297 if err != nil {
298 return 0, false, fmt.Errorf("invalid payload timeout '%s'", v)
299 }
300 return n, true, nil
301 default:
302 return 0, false, fmt.Errorf("invalid payload timeout type %T", raw)
303 }
304}
305
306func resolveFunctionTimeout(flagValue string, payloadTimeout time.Duration) (time.Duration, error) {
307 if flagValue != "" {

Callers 1

readFunctionPayloadFunction · 0.85

Calls 1

ErrorfMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…