INNER CODE UNIT · Go

parseTTL

redpanda-data/connect · benchmarking/aws/cleanup-lambda/main.go:201

func parseTTL(raw string) (time.Duration, error) {
	if raw == "" {
		return 0, errors.New("BENCH_ORPHAN_TTL_HOURS is required")
	}
	h, err := strconv.ParseFloat(raw, 64)
	if err != nil || h <= 0 {
		return 0, fmt.Errorf("BENCH_ORPHAN_TTL_HOURS must be a positive number of hours, got %q", raw)
	}
	return time.Duration(h * float64(time.Hour)), nil
}

func handleRequest(ctx context.Context, _ struct{}) (SweepReport, error) {
	ttl, err := parseTTL(os.Getenv("BENCH_ORPHAN_TTL_HOURS"))
	if err != nil {
		return SweepReport{}, err
	}
	topicARN := os.Getenv("BENCH_ORPHAN_SNS_TOPIC_ARN")
	if topicARN == "" {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…