From 897fb4455e5ee3ed5956ad466a3c4b435d6fad40 Mon Sep 17 00:00:00 2001 From: Emran Date: Tue, 13 May 2025 14:24:28 +0330 Subject: [PATCH] fix: skip empty batches of events Fixes #2 --- langfuse.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/langfuse.go b/langfuse.go index ed68d56..8ab7d8e 100644 --- a/langfuse.go +++ b/langfuse.go @@ -47,10 +47,14 @@ func (l *Langfuse) WithFlushInterval(d time.Duration) *Langfuse { } func ingest(ctx context.Context, client *api.Client, events []model.IngestionEvent) error { + if len(events) == 0 { + return nil + } + req := api.Ingestion{ Batch: events, } - + // TODO: Check response status and at least log the partial failures (if not retry) res := api.IngestionResponse{} return client.Ingestion(ctx, &req, &res) }