(payload map[string]any)
| 275 | } |
| 276 | |
| 277 | func 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 | |
| 306 | func resolveFunctionTimeout(flagValue string, payloadTimeout time.Duration) (time.Duration, error) { |
| 307 | if flagValue != "" { |
no test coverage detected
searching dependent graphs…